Class RabbitMQUtils
- java.lang.Object
-
- org.wso2.carbon.inbound.endpoint.protocol.rabbitmq.RabbitMQUtils
-
public class RabbitMQUtils extends Object
Helper class to support AMQP inbound endpoint related functions
-
-
Constructor Summary
Constructors Constructor Description RabbitMQUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
buildMessage(com.rabbitmq.client.AMQP.BasicProperties properties, byte[] body, org.apache.axis2.context.MessageContext msgContext)
Build SOAP envelop from AMQP properties and byte bodystatic com.rabbitmq.client.Connection
createConnection(com.rabbitmq.client.ConnectionFactory factory, com.rabbitmq.client.Address[] addresses)
Create a connection from given connection factory and address arraystatic void
declareExchange(com.rabbitmq.client.Channel channel, String exchangeName, Map<String,String> properties)
Helper method to declare exchange when direct channel is givenstatic void
declareQueue(com.rabbitmq.client.Channel channel, String queueName, Map<String,String> properties)
Helper method to declare queue when direct channel is givenstatic Map<String,String>
getTransportHeaders(com.rabbitmq.client.AMQP.BasicProperties properties)
Get transport headers from the rabbitmq messagestatic boolean
isAutoDeleteExchange(Map<String,String> properties)
static boolean
isAutoDeleteQueue(Map<String,String> properties)
static boolean
isDurableExchange(Map<String,String> properties)
static boolean
isDurableQueue(Map<String,String> properties)
static boolean
isExclusiveQueue(Map<String,String> properties)
-
-
-
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
- aConnectionFactory
objectaddresses
- aAddress
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
-
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 channelqueueName
- a name of the queue to declareproperties
- 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
objectexchangeName
- the exchange exchangeNameproperties
- 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 propertiesbody
- the message bodymsgContext
- the message context- Returns:
- content-type used to build the soap message
- Throws:
org.apache.axis2.AxisFault
-
-