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 StringbuildMessage(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.ConnectioncreateConnection(com.rabbitmq.client.ConnectionFactory factory, com.rabbitmq.client.Address[] addresses)Create a connection from given connection factory and address arraystatic voiddeclareExchange(com.rabbitmq.client.Channel channel, String exchangeName, Map<String,String> properties)Helper method to declare exchange when direct channel is givenstatic voiddeclareQueue(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 booleanisAutoDeleteExchange(Map<String,String> properties)static booleanisAutoDeleteQueue(Map<String,String> properties)static booleanisDurableExchange(Map<String,String> properties)static booleanisDurableQueue(Map<String,String> properties)static booleanisExclusiveQueue(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 IOExceptionCreate a connection from given connection factory and address array- Parameters:
factory- aConnectionFactoryobjectaddresses- aAddressobject- Returns:
- a
Connectionobject - 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 IOExceptionHelper 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 IOExceptionHelper method to declare exchange when direct channel is given- Parameters:
channel-ChannelobjectexchangeName- 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
-
-