This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
RabbitMQ AMQP Transport
AMQP is a wire-level messaging protocol that describes the format of the data that is sent across the network. If a system or application can read and write AMQP, it can exchange messages with any other system or application that understands AMQP, regardless of the implementation language.
The RabbitMQ AMQP transport is implemented using the RabbitMQ Java Client. It allows you to send or receive AMQP messages by calling an AMQP broker (RabbitMQ) directly, without the need to use different transport mechanisms, such as JMS.
The following diagram illustrates a scenario where the WSO2 Enterprise Integrator(WSO2 EI) uses the RabbitMQ AMQP transport to exchange messages between RabbitMQ Java Clients by calling RabbitMQ brokers.
As you can see in the diagram, the Sender uses the RabbitMQ Java Client to publish messages to an AMQP queue (Q1), and the Receiver users it to consume messages from an AMQP queue (Q2). In this scenario, a proxy service in the WSO2 EI listens to Q1, and when a message becomes available on the queue, the proxy service consumes it and publishes it to Q2.
This section provides information on configuring the RabbitMQ transport in WSO2 EI along with information on how to enable connection recovery, how to enable SSL support as well as a sample RabbitMQ proxy service to describe how to use the RabbitMQ transport.
Open
<EI_HOME>/conf/axis2/axis2.xmlfor editing.In the transport listeners section, add the following RabbitMQ transport listener, replacing the values with your host, port, username, and password to connect to the AMQP broker.
<transportReceiver name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQListener"> <parameter name="AMQPConnectionFactory" locked="false"> <parameter name="rabbitmq.server.host.name" locked="false">192.168.0.3</parameter> <parameter name="rabbitmq.server.port" locked="false">5672</parameter> <parameter name="rabbitmq.server.user.name" locked="false">user</parameter> <parameter name="rabbitmq.server.password" locked="false">abc123</parameter> </parameter> </transportReceiver>As an optional step, you can create multiple connection factories if you want this listener to connect to multiple brokers.
In the transport senders section, add the following RabbitMQ transport sender, which will be used for sending AMQP messages to a queue:
<transportSender name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQSender"/>Start WSO2 EI.
RabbitMQ AMQP transport parameters
Following are details on the listener parameters you can set:
Parameter | Description | Required |
|---|---|---|
| The name of the connection factory. | Yes |
| Name of the RabbitMQ exchange to which the queue is bound. Use this parameter instead of | No |
| The queue name to send or consume messages. If you do not specify this parameter, you need to specify the | Yes |
| Defines how the message processor sends the acknowledgement when consuming messages recived from the RabbitMQ message store. If you set this to true, the message processor automatically sends the acknowledgement to the messages store as soon as it receives messages from it. This is called an auto acknowledgement. If you set it to false, the message processor waits until it receives the response from the backend to send the acknowledgement to the mssage store. This is called a client acknowledgement. | No |
| The client generated consumer tag to establish context. | No |
| The consumer qos value. You need to specify this parameter only if the | No |
| Whether the queue should remain declared even if the broker restarts. | No |
| Whether the queue should be exclusive or should be consumable by other connections. | No |
| Whether to keep the queue even if it is not being consumed anymore. | No |
| The routing key of the queue. | No |
| The type of the exchange. | No |
| Whether the exchange should remain declared even if the broker restarts. | No |
| Whether to keep the exchange even if it is not bound to any queue anymore. | No |
| The content type of the consumer. Note If the content type is specified in the message, this parameter does not override the specified content type. | No. The default value is |
| Whether to create queues if they are not present. However, you should set this parameter only if queues are not declared prior on the broker. Setting this parameter in the publish URL to | No |
| Whether to create exchanges if they are not present. However, you should set this parameter only if exchanges are not declared prior on the broker. Setting this parameter in the publish URL to | No |
Following are details on the sender parameters you can set:
Parameter | Description | Required |
|---|---|---|
| Host name of the server. | Yes |
| Port number of the server. | Yes |
| The name of the RabbitMQ exchange to which the queue is bound. Use this parameter instead of | No |
| The exchange and queue binding key that will be used to route messages. | No |
| The name of the call back queue. Specify this parameter if you expect a response. | No |
| The delivery mode of the queue. Possible values are 1 and 2. | No |
| The type of the exchange. | No |
| The queue name to send or consume messages. If you do not specify this parameter, you need to specify the | Yes |
| Whether the queue should remain declared even if the broker restarts. The default value is | No |
| Whether the queue should be exclusive or should be consumable by other connections. The default value is | No |
| Whether to keep the queue even if it is not being consumed anymore. The default value is | No |
| Whether the exchange should remain declared even if the broker restarts. | No |
| Whether to create queues if they are not present. However, you should set this parameter only if queues are not declared prior on the broker. Setting this parameter in the publish URL to | No |
| Whether to create exchanges if they are not present. However, you should set this parameter only if exchanges are not declared prior on the broker. Setting this parameter in the publish URL to | No |