RabbitMQ Inbound Protocol
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.
Configuration parameters for a RabbitMQ inbound endpoint are XML fragments that represent various properties.
Following is a sample RabbitMQ inbound endpoint configuration that consumes a messages from a queue:
<inboundEndpoint xmlns="http://ws.apache.org/ns/synapse" name="RabbitMQConsumer" sequence="amqpSeq" onError="amqpErrorSeq" protocol="rabbitmq" suspend="false"> <parameters> <parameter name="sequential">true</parameter> <parameter name="coordination">true</parameter> Â <parameter name="rabbitmq.connection.factory">AMQPConnectionFactory</parameter> <parameter name="rabbitmq.server.host.name">localhost</parameter> <parameter name="rabbitmq.server.port">5672</parameter> <parameter name="rabbitmq.server.user.name">guest</parameter> <parameter name="rabbitmq.server.password">guest</parameter> Â <parameter name="rabbitmq.queue.name">queue</parameter> <parameter name="rabbitmq.exchange.name">exchange</parameter> <parameter name="rabbitmq.connection.ssl.enabled">false</parameter> </parameters> </inboundEndpoint>
RabbitMQ inbound endpoint parameters
Parameter Name | Description | Required |
---|---|---|
sequential | The behaviour when executing the given sequence. | Yes |
rabbitmq.connection.factory | Name of the connection factory. | Yes |
rabbitmq.server.host.name | Host name of the server. | Yes |
rabbitmq.server.port | The port number of the server. | Yes |
rabbitmq.server.user.name | The user name to connect to the server. | Yes |
rabbitmq.server.password | The password to connect to the server. | Yes |
rabbitmq.queue.name | The queue name to send or consume messages. | Yes |
rabbitmq.exchange.name | The name of the RabbitMQ exchange to which the queue is bound. | Yes |
rabbitmq.server.virtual.host | The virtual host name of the server, if available. | No |
rabbitmq.connection.ssl.enabled | Whether to use tcp connection or ssl connection. | No |
rabbitmq.connection.ssl.keystore.location | The keystore location. | No |
rabbitmq.connection.ssl.keystore.type | The keystore type. | No |
rabbitmq.connection.ssl.keystore.password | The keystore password. | No |
rabbitmq.connection.ssl.truststore.location | The truststore location. | No |
rabbitmq.connection.ssl.truststore.type | The truststore  type. | No |
rabbitmq.connection.ssl.truststore.password | The truststore password. | No |
rabbitmq.connection.ssl.version | The ssl version. | No |
rabbitmq.queue.durable | 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 keep the queue even if it is not being consumed anymore. | No |
rabbitmq.queue.auto.ack | Whether to send back an acknowledgement. | No |
rabbitmq.queue.routing.key | The routing key of the queue. | No |
rabbitmq.queue.delivery.mode | The delivery mode of the queue (ie., Whether it is persistent or not). | 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 queue even if it is not used anymore. | No |
rabbitmq.factory.heartbeat | The period of time after which the connection should be considered dead. | No |
rabbitmq.message.content.type | The content type of the message. | No |
Connection recovery parameters
In case of a network failure or broker shutdown, the ESB can try to recreate the connection.
If you want to enable connection recovery, you should configure the following parameters in the inbound endpoint:
<parameter name="rabbitmq.connection.retry.interval" locked="false">10000</parameter> <parameter name="rabbitmq.connection.retry.count" locked="false">5</parameter>
If the parameters are configured with sample values as given above, the ESB makes 5 retry attempts with a time interval of 10000 ms between each retry attempt to reconnect when the connection is lost. If reconnecting fails after 5 retry attempts, the ESB terminates the connection.
In addition to the above parameters, if you want to set the interval between retry attempts with which the RabbitMQ client should try reconnecting to the ESB, you can configure the following parameter:Â
<parameter name="rabbitmq.server.retry.interval" locked="false">10000</parameter>
Setting the value of rabbitmq.server.retry.interval
to be less than the value of rabbitmq.connection.retry.interval
 helps synchronize the reconnection of the ESB and the RabbitMQ client.
Samples
For a sample that demonstrates how one way message bridging from RabbitMQ to HTTP can be done using the RabbitMQ inbound endpoint, see Sample 907: Inbound Endpoint RabbitMQ Protocol Sample.