Class RabbitMQUtils


  • public class RabbitMQUtils
    extends Object
    Helper class to support AMQP inbound endpoint related functions
    • Constructor Detail

      • RabbitMQUtils

        public RabbitMQUtils()
    • Method Detail

      • createConnection

        public static com.rabbitmq.client.Connection createConnection​(com.rabbitmq.client.ConnectionFactory factory,
                                                                      com.rabbitmq.client.Address[] addresses)
                                                               throws IOException
        Create a connection from given connection factory and address array
        Parameters:
        factory - a ConnectionFactory object
        addresses - a Address object
        Returns:
        a Connection object
        Throws:
        IOException
      • getTransportHeaders

        public static Map<String,​String> getTransportHeaders​(com.rabbitmq.client.AMQP.BasicProperties properties)
        Get transport headers from the rabbitmq message
        Parameters:
        properties - the AMQP basic properties
        Returns:
        a map of headers
      • isDurableQueue

        public static boolean isDurableQueue​(Map<String,​String> properties)
      • isExclusiveQueue

        public static boolean isExclusiveQueue​(Map<String,​String> properties)
      • isAutoDeleteQueue

        public static boolean isAutoDeleteQueue​(Map<String,​String> properties)
      • isDurableExchange

        public static boolean isDurableExchange​(Map<String,​String> properties)
      • isAutoDeleteExchange

        public static boolean isAutoDeleteExchange​(Map<String,​String> properties)
      • declareQueue

        public static void declareQueue​(com.rabbitmq.client.Channel channel,
                                        String queueName,
                                        Map<String,​String> properties)
                                 throws IOException
        Helper method to declare queue when direct channel is given
        Parameters:
        channel - a rabbitmq channel
        queueName - a name of the queue to declare
        properties - queue declaration properties
        Throws:
        IOException
      • declareExchange

        public static void declareExchange​(com.rabbitmq.client.Channel channel,
                                           String exchangeName,
                                           Map<String,​String> properties)
                                    throws IOException
        Helper method to declare exchange when direct channel is given
        Parameters:
        channel - Channel object
        exchangeName - the exchange exchangeName
        properties - RabbitMQ properties
        Throws:
        IOException
      • buildMessage

        public static String buildMessage​(com.rabbitmq.client.AMQP.BasicProperties properties,
                                          byte[] body,
                                          org.apache.axis2.context.MessageContext msgContext)
                                   throws org.apache.axis2.AxisFault
        Build SOAP envelop from AMQP properties and byte body
        Parameters:
        properties - the AMQP basic properties
        body - the message body
        msgContext - the message context
        Returns:
        content-type used to build the soap message
        Throws:
        org.apache.axis2.AxisFault