Class MQConnection

  • All Implemented Interfaces:
    com.rabbitmq.client.ShutdownListener, EventListener

    public final class MQConnection
    extends Object
    implements com.rabbitmq.client.ShutdownListener
    Creates an MQ connection.
    Author:
    Isac Holm <isac.holm@axis..com>
    • Method Detail

      • getInstance

        public static MQConnection getInstance()
        Gets the instance.
        Returns:
        the instance
      • getSizeOutstandingConfirms

        public int getSizeOutstandingConfirms()
        Get the number of currently outstanding confirms.
        Returns:
        the number of currently outstanding confirms
      • clearOutstandingConfirms

        public void clearOutstandingConfirms()
        Clear the outstanding confirms list, useful when testing.
      • addMessageToQueue

        public void addMessageToQueue​(String exchange,
                                      String routingKey,
                                      com.rabbitmq.client.AMQP.BasicProperties props,
                                      byte[] body)
        Puts a message in the message queue.
        Parameters:
        exchange - the exchange to publish the message to
        routingKey - the routing key
        props - other properties for the message - routing headers etc
        body - the message body
      • getConnection

        public com.rabbitmq.client.Connection getConnection()
        Gets the connection.
        Returns:
        the connection.
      • initialize

        public void initialize​(String name,
                               Secret password,
                               String uri,
                               String vh)
        Initializes this instance with supplied values.
        Parameters:
        name - the user name
        password - the user password
        uri - the server uri
        vh - the virtual host
      • shutdownCompleted

        public void shutdownCompleted​(com.rabbitmq.client.ShutdownSignalException cause)
        Specified by:
        shutdownCompleted in interface com.rabbitmq.client.ShutdownListener