Class ChannelUtil

java.lang.Object
com.mirth.connect.server.userutil.ChannelUtil

public class ChannelUtil extends Object
This utility class allows the user to query information from channels or to perform actions on channels.
  • Method Details

    • getChannelNames

      public static List<String> getChannelNames()
      Get all channels names.
      Returns:
      A list of all channel names.
    • getChannelIds

      public static List<String> getChannelIds()
      Get all channel Ids.
      Returns:
      A list of all channel Ids.
    • getDeployedChannelNames

      public static List<String> getDeployedChannelNames()
      Get all deployed channels names.
      Returns:
      A list of all deployed channel names.
    • getChannelName

      public static String getChannelName(String channelId)
      Get the name for a channel.
      Parameters:
      channelId - The channel id of the channel.
      Returns:
      The channel name of the specified channel.
    • getDeployedChannelIds

      public static List<String> getDeployedChannelIds()
      Get all deployed channel Ids.
      Returns:
      A list of all deployed channel Ids.
    • getDeployedChannelName

      public static String getDeployedChannelName(String channelId)
      Get the name for a deployed channel.
      Parameters:
      channelId - The channel id of the deployed channel.
      Returns:
      The channel name of the specified channel.
    • getDeployedChannelId

      public static String getDeployedChannelId(String channelName)
      Get the id for a deployed channel.
      Parameters:
      channelName - The channel name of the deployed channel.
      Returns:
      The channel Id of the specified channel.
    • startChannel

      public static Future<Void> startChannel(String channelIdOrName) throws Exception
      Start a deployed channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
      Throws:
      Exception - If the task cannot be scheduled for execution.
    • stopChannel

      public static Future<Void> stopChannel(String channelIdOrName) throws Exception
      Stop a deployed channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
      Throws:
      Exception - If the task cannot be scheduled for execution.
    • pauseChannel

      public static Future<Void> pauseChannel(String channelIdOrName) throws Exception
      Pause a deployed channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
      Throws:
      Exception - If the task cannot be scheduled for execution.
    • resumeChannel

      public static Future<Void> resumeChannel(String channelIdOrName) throws Exception
      Resume a deployed channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
      Throws:
      Exception - If the task cannot be scheduled for execution.
    • haltChannel

      public static Future<Void> haltChannel(String channelIdOrName) throws Exception
      Halt a deployed channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
      Throws:
      Exception - If the task cannot be scheduled for execution.
    • getChannelState

      public static DeployedState getChannelState(String channelIdOrName)
      Get the current state of a channel.
      Parameters:
      channelIdOrName - The channel id or current name of the channel.
      Returns:
      The current DeployedState.
    • deployChannel

      public static Future<Void> deployChannel(String channelIdOrName)
      Deploy a channel.
      Parameters:
      channelIdOrName - The channel id or current name of the channel.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
    • undeployChannel

      public static Future<Void> undeployChannel(String channelIdOrName)
      Undeploy a channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
    • isChannelDeployed

      public static boolean isChannelDeployed(String channelIdOrName)
      Check if a channel is currently deployed.
      Parameters:
      channelIdOrName - The channel id or current name of the channel.
      Returns:
      True if the channel is deployed, false if it is not.
    • startConnector

      public static Future<Void> startConnector(String channelIdOrName, Integer metaDataId) throws Exception
      Start a connector on a given channel.
      Parameters:
      channelIdOrName - The channel id or current name of the channel.
      metaDataId - The metadata id of the connector. Note that the source connector has a metadata id of 0.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
      Throws:
      Exception - If the task cannot be scheduled for execution.
    • stopConnector

      public static Future<Void> stopConnector(String channelIdOrName, Integer metaDataId) throws Exception
      Stop a connector on a given channel.
      Parameters:
      channelIdOrName - The channel id or current name of the channel.
      metaDataId - The metadata id of the connector. Note that the source connector has a metadata id of 0.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
      Throws:
      Exception - If the task cannot be scheduled for execution.
    • getConnectorState

      public static DeployedState getConnectorState(String channelIdOrName, Number metaDataId)
      Get the current state of a connector.
      Parameters:
      channelIdOrName - The channel id or current name of the channel.
      metaDataId - The metadata id of the connector. Note that the source connector has a metadata id of 0.
      Returns:
      The current connector state returned as the DeployedState enumerator.
    • getReceivedCount

      public static Long getReceivedCount(String channelIdOrName)
      Get the received count statistic for a specific channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      The received count statistic as a Long for the specified channel.
    • getReceivedCount

      public static Long getReceivedCount(String channelIdOrName, Number metaDataId)
      Get the received count statistic for a specific connector.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      metaDataId - The metadata id of the connector. Note that the source connector has a metadata id of 0.
      Returns:
      The received count statistic as a Long for the specified connector.
    • getFilteredCount

      public static Long getFilteredCount(String channelIdOrName)
      Get the filtered count statistic for a specific channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      The filtered count statistic as a Long for the specified channel.
    • getFilteredCount

      public static Long getFilteredCount(String channelIdOrName, Number metaDataId)
      Get the filtered count statistic for a specific connector.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      metaDataId - The metadata id of the connector. Note that the source connector has a metadata id of 0.
      Returns:
      The filtered count statistic as a Long for the specified connector.
    • getQueuedCount

      public static Long getQueuedCount(String channelIdOrName)
      Get the queued count statistic for a specific channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      The queued count statistic as a Long for the specified channel.
    • getQueuedCount

      public static Long getQueuedCount(String channelIdOrName, Number metaDataId)
      Get the queued count statistic for a specific connector.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      metaDataId - The metadata id of the connector. Note that the source connector has a metadata id of 0.
      Returns:
      The queued count statistic as a Long for the specified connector.
    • getSentCount

      public static Long getSentCount(String channelIdOrName)
      Get the sent count statistic for a specific channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      The sent count statistic as a Long for the specified channel.
    • getSentCount

      public static Long getSentCount(String channelIdOrName, Number metaDataId)
      Get the sent count statistic for a specific connector.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      metaDataId - The metadata id of the connector. Note that the source connector has a metadata id of 0.
      Returns:
      The sent count statistic as a Long for the specified connector.
    • getErrorCount

      public static Long getErrorCount(String channelIdOrName)
      Get the error count statistic for a specific channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      The error count statistic as a Long for the specified channel.
    • getErrorCount

      public static Long getErrorCount(String channelIdOrName, Number metaDataId)
      Get the error count statistic for a specific connector.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      metaDataId - The metadata id of the connector. Note that the source connector has a metadata id of 0.
      Returns:
      The error count statistic as a Long for the specified connector.
    • resetStatistics

      public static Future<Void> resetStatistics(String channelIdOrName) throws Exception
      Reset all statistics for a specific channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
      Throws:
      Exception - If the task cannot be scheduled for execution.
    • resetStatistics

      public static Future<Void> resetStatistics(String channelIdOrName, Integer metaDataId) throws Exception
      Reset all statistics for the specified connector on the given channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      metaDataId - The metadata id of the deployed connector. Note that the source connector has a metadata id of 0 and the aggregate of null.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
      Throws:
      Exception - If the task cannot be scheduled for execution.
    • resetStatistics

      public static Future<Void> resetStatistics(String channelIdOrName, Integer metaDataId, Collection<Status> statuses) throws Exception
      Reset the specified statistics for the specified connector on the given channel.
      Parameters:
      channelIdOrName - The channel id or current name of the deployed channel.
      metaDataId - The metadata id of the deployed connector. Note that the source connector has a metadata id of 0 and the aggregate of null.
      statuses - A collection of statuses to reset.
      Returns:
      A Future object representing the result of the asynchronous operation. You can call get() or get(timeoutInMillis) to wait for the operation to finish.
      Throws:
      Exception - If the task cannot be scheduled for execution.