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.
...
Table of Contents | ||||
---|---|---|---|---|
|
...
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.
...
Table of Contents | ||||
---|---|---|---|---|
|
...
Anchor | ||||
---|---|---|---|---|
|
- Open
<EI_HOME>/conf/axis2/axis2.xml
for 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.
Code Block language html/xml <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:
Code Block language html/xml <transportReceiver<transportSender name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQListenerRabbitMQSender"> <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:
Code Block language html/xml <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:
...
/>
- Start WSO2 EI.
RabbitMQ AMQP transport parameters
Following are details on the listener parameters you can set:
Parameter | Description | Required |
---|---|---|
rabbitmq.connection.factory | The name of the connection factory. | Yes |
rabbitmq.exchange.name | Name of the RabbitMQ exchange to which the queue is bound. Use this parameter instead of rabbitmq.queue.routing.key , if you need to use the default exchange and publish to a queue. | No |
rabbitmq.queue.name | The queue name to send or consume messages. If you do not specify this parameter, you need to specify the rabbitmq.queue.routing.key parameter. | Yes |
rabbitmq.queue.auto.ack | 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 |
rabbitmq.consumer.tag | The client generated consumer tag to establish context. | No |
rabbitmq.channel.consumer.qos | The consumer qos value. You need to specify this parameter only if the rabbitmq.queue.auto.ack parameter is set to false . | No |
rabbitmq.queue. |
durable |
rabbitmq.queue.routing.key
parameter.Whether the queue should remain declared even if the broker restarts. | No | |
rabbitmq.queue.exclusive | Whether the queue should be exclusive or should be consumable by other connections. | No |
rabbitmq.queue.auto. |
delete | Whether to |
rabbitmq.consumer.tag
rabbitmq.channel.consumer.qos
rabbitmq.queue.auto.ack
parameter is set to false
.keep the queue even if it is not being consumed anymore. | No | |
rabbitmq.queue.routing.key | The routing key of the queue. | No |
rabbitmq.exchange.type | The type of the exchange. | No |
rabbitmq.exchange.durable | Whether the |
exchange should remain declared even if the broker restarts. | No |
rabbitmq. |
exchange.auto.delete | Whether to keep |
the exchange even if it is not |
bound to any queue anymore. | No |
rabbitmq. |
message.content.type | The content type of the |
consumer. |
rabbitmq.exchange.durable
rabbitmq.exchange.auto.delete
rabbitmq.message.content.type
The content type of the consumer.
Info | ||
---|---|---|
| ||
If the content type is specified in the message, this parameter does not override the specified content type. |
text/xml
....
| No. The default value is text/xml . | |||||
rabbitmq.queue.autodeclare | 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 false improves RabbitMQ transport performance. | No | ||||
rabbitmq.exchange.autodeclare | 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 false improves RabbitMQ transport performance. | No |
Anchor | ||||
---|---|---|---|---|
|
Parameter | Description | Required |
---|---|---|
rabbitmq.server.host.name | Host name of the server. | Yes |
rabbitmq.server.port | Port number of the server. | Yes |
rabbitmq.exchange.name | The name of the RabbitMQ exchange to which the queue is bound. Use this parameter instead of | No |
rabbitmq.queue.routing.key | The exchange and queue binding key that will be used to route messages. | No |
rabbitmq.replyto.name | The name of the call back queue. Specify this parameter if you expect a response. | No |
rabbitmq.queue.delivery.mode | The delivery mode of the queue. Possible values are 1 and 2. | No |
rabbitmq.exchange.type | The type of the exchange. | No |
rabbitmq.queue.name | The queue name to send or consume messages. If you do not specify this parameter, you need to specify the rabbitmq.queue.routing.key parameter. | Yes |
rabbitmq.queue.durable | Whether the queue should remain declared even if the broker restarts. The default value is false . | No |
rabbitmq.queue.exclusive | Whether the queue should be exclusive or should be consumable by other connections. The default value is false | No |
rabbitmq.queue.auto.delete | Whether to keep the queue even if it is not being consumed anymore. The default value is false . | No |
rabbitmq.exchange.durable | Whether the exchange should remain declared even if the |
false
broker restarts. | No | |
rabbitmq.queue.autodeclare | 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 false improves RabbitMQ transport performance. | No |
rabbitmq.exchange. |
autodeclare | 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 false improves RabbitMQ transport performance. | No |
For the rabbitmq.server
, properties refer to the server on which RabbitMQ is running.
...