Class JMSConnectorCheck


  • public final class JMSConnectorCheck
    extends Object
    Component allowing to check a JMS connector.
    • Field Detail

      • logger

        private static final Logger logger
      • DEBUG

        private static final boolean DEBUG
      • info

        static final String[] info
      • retryStatusCount

        private int retryStatusCount
        retryStatusCount == 0 => RUNNING, retryStatusCount > 0 => UNREACHABLE
      • nbtry

        private int nbtry
      • failures

        private transient int failures
      • errorMsg

        private String errorMsg
      • lastConnectTime

        private String lastConnectTime
      • latencyConnect

        private long latencyConnect
      • latencyPubSub

        private long latencyPubSub
      • timeout

        private int timeout
        The maximum time waiting for connection.
      • cfname

        private String cfname
        JNDI Name of the ConnectionFactory to use.
      • cf

        private jakarta.jms.ConnectionFactory cf
      • queue

        private Queue queue
    • Constructor Detail

      • JMSConnectorCheck

        public JMSConnectorCheck​(String cfname,
                                 InitialContext ictx,
                                 String user,
                                 String pass,
                                 String qname,
                                 int timeOut)
        Creates a new component allowing to check a JMS connector.
        Parameters:
        cfname - JNDI name of the ConnectionFactory to use.
        ictx - JNDI context allowing to retrieve ConnectionFactory.
        user - User name for authentication, if no defined uses the ConnectionFactory default.
        pass - Password for authentication, if no defined uses the ConnectionFactory default.
        qname - Internal name of JMS destination.
        timeout - Maximum amount of time to wait connecting and receiving messages, by default 10s.
      • JMSConnectorCheck

        public JMSConnectorCheck​(jakarta.jms.ConnectionFactory cf,
                                 String user,
                                 String pass,
                                 String qname,
                                 int timeOut)
        Creates a new component allowing to check a JMS connector.
        Parameters:
        cf - ConnectionFactory to use.
        user - User name for authentication, if no defined uses the ConnectionFactory default.
        pass - Password for authentication, if no defined uses the ConnectionFactory default.
        qname - Internal name of JMS destination.
        timeout - Maximum amount of time to wait connecting and receiving messages, by default 10s.
    • Method Detail

      • getStatus

        public int getStatus()
        Returns the status of the connector: 0 => RUNNING, >0 => UNREACHABLE.
        Returns:
        the number of unreachable connection
      • getStatusInfo

        public String getStatusInfo()
      • setStatus

        private void setStatus​(int retry)
      • getNbTry

        public int getNbTry()
        Returns the total number of try since starting.
        Returns:
        the total number of try since starting.
      • getNbFailures

        public int getNbFailures()
        Returns the total number of failures since starting.
        Returns:
        the total number of failures since starting.
      • getErrorMsg

        public String getErrorMsg()
        Returns the error message of the last try. Returns null if the test is successful.
        Returns:
      • getLastConnectTime

        public String getLastConnectTime()
        Returns the date of last successful connection.
        Returns:
        the date of last successful connection.
      • getLatencyConnect

        public long getLatencyConnect()
        Returns the latency of the connection during the last try. Returns -1 if the test failed.
        Returns:
        the latency of the connection during the last try.
      • setLatencyConnect

        private void setLatencyConnect​(long latencyConnect)
      • getLatencyPubSub

        public long getLatencyPubSub()
        Returns the latency of the send/receive during the last try. Returns -1 if the test failed.
        Returns:
        the latency of the send/receive during the last try.
      • setLatencyPubSub

        private void setLatencyPubSub​(long latencyPubSub)
      • getTimeOut

        public int getTimeOut()
        Returns the maximum time waiting for connection.
        Returns:
        the maximum time waiting for connection.
      • setTimeOut

        public void setTimeOut​(int timeOut)
        Sets the maximum time waiting for connection.
        Parameters:
        timeOut - the maximum time waiting for connection.
      • getCFName

        public String getCFName()
      • check

        public boolean check()
        Checks the related JMS connector, creates a connection, then sends and receives a message. After the call the test results are updated.
        Returns:
        true if the check is successful, false otherwise.