Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

Image Removed

...

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.

Table of Contents
maxLevel3
typeflat

...

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.

Image Added


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.

...

Table of Contents
maxLevel3
typeflat

...

Anchor
ConfigRabbitMQ
ConfigRabbitMQ
Configuring the RabbitMQ AMQP transport

  1. Open <EI_HOME>/conf/axis2/axis2.xml for editing.
  2. 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
    languagehtml/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.

  3. In the transport senders section, add the following RabbitMQ transport sender, which will be used for sending AMQP messages to a queue:

    Code Block
    languagehtml/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.

  4. In the transport senders section, add the following RabbitMQ transport sender, which will be used for sending AMQP messages to a queue:

    Code Block
    languagehtml/xml
    <transportSender name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQSender"/>
  5. Start WSO2 EI.

RabbitMQ AMQP transport parameters

Following are details on the listener parameters you can set:

...

  1. />
  2. Start WSO2 EI.

RabbitMQ AMQP transport parameters

Following are details on the listener parameters you can set:

ParameterDescriptionRequired
rabbitmq.connection.factoryThe name of the connection factory.Yes
rabbitmq.exchange.nameName 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.nameThe 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.tagThe client­ generated consumer tag to establish context.No
rabbitmq.channel.consumer.qosThe consumer qos value. You need to specify this parameter only if the rabbitmq.queue.auto.ack parameter is set to false.No
rabbitmq.queue.
nameYes
durable
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.
Whether the queue should remain declared even if the broker restarts. No
rabbitmq.queue.exclusiveWhether the queue should be exclusive or should be consumable by other connections. No
rabbitmq.queue.auto.
ack
deleteWhether to
automatically send back an acknowledgment when consuming messages from queue.Norabbitmq.consumer.tagThe client­ generated consumer tag to establish context.Norabbitmq.channel.consumer.qosThe consumer qos value. You need to specify this parameter only if the rabbitmq.queue.auto.ack parameter is set to false.Norabbitmq.queue
keep the queue even if it is not being consumed anymore. No
rabbitmq.queue.routing.keyThe routing key of the queue. No
rabbitmq.exchange.typeThe type of the exchange. No
rabbitmq.exchange.durableWhether the
queue
exchange should remain declared even if the broker restarts. No
rabbitmq.
queue.exclusiveWhether the queue should be exclusive or should be consumable by other connections. Norabbitmq.queue
exchange.auto.deleteWhether to keep
the queue even
the exchange even if it is not
being consumed
bound to any queue anymore. No
rabbitmq.
queue.routing.keyThe routing key of the queue. Norabbitmq.exchange.
message.content.type

The content type of the

exchange

consumer.

 Norabbitmq.exchange.durableWhether the exchange should remain declared even if the broker restarts. Norabbitmq.exchange.auto.deleteWhether to keep the queue even if it is not used anymore. Norabbitmq.message.content.type

The content type of the consumer.

Info
titleNote

If the content type is specified in the message, this parameter does not override the specified content type.

 No. The default value is text/xml.

...

Info
titleNote

If the content type is specified in the message, this parameter does not override the specified content type.

 No. The default value is text/xml.
rabbitmq.queue.autodeclareWhether 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.autodeclareWhether 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
senderParameters
senderParameters
Following are details on the sender parameters you can set:

ParameterDescriptionRequired
rabbitmq.server.host.nameHost name of the server.Yes
rabbitmq.server.portPort 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 rabbitmq.queue.routing.key, if you need to use the default exchange and publish to a queue.

No
rabbitmq.queue.routing.keyThe exchange and queue binding key that will be used to route messages.No
rabbitmq.replyto.nameThe 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.
1 - Non­-persistent.
2 - Persistent. This is the default value.

No
rabbitmq.exchange.typeThe type of the exchange.No
rabbitmq.queue.nameThe 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.durableWhether the queue should remain declared even if the broker restarts. The default value is false.No
rabbitmq.queue.exclusiveWhether the queue should be exclusive or should be consumable by other connections. The default value is falseNo
rabbitmq.queue.auto.deleteWhether to keep the queue even if it is not being consumed anymore. The default value is false.No
rabbitmq.exchange.durableWhether the exchange should remain declared even if the
queue even if it is not being consumed anymore. The default value is false
broker restarts.No
rabbitmq.queue.autodeclareWhether 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.
durable
autodeclareWhether
the exchange should remain declared even if the broker restarts
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.

...