Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
h2. RabbitMQ Component

*Available as of Camel 2.12*

The *rabbitmq:* component allows you produce and consume messages from [RabbitMQ|http://www.rabbitmq.com/] instances. Using the RabbitMQ AMQP client, this component offers a pure RabbitMQ approach over the generic *amqp:* component.

Maven users will need to add the following dependency to their {{pom.xml}} for this component:

{code:xml}
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-rabbitmq</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>
{code}

h3. URI format

{code}
rabbitmq:http://hostname[:port]/exchangeName?[options...]://name[?options]
{code}

Where *hostname* is the hostname of the running rabbitmq instance or cluster. Port is optional and if not specified then defaults to the RabbitMQ client default (5672). The exchange name is only needed for producers. For 

h3. Options
{div:class=confluenceTableSmall}
|| Property || Default || Description ||
| {{autoAck}} | {{true}} |  |
| {{queue}} | {{random uuid}} |  |
| {{routingKey}} | {{null}} |  |
| {{threadPoolSize}} | {{10}} |  |
| {{username}} | {{null}} | username in case of authenticated access |
| {{password}} | {{null}} | password for authenticated access |
{div}

h3. Headers

The following headers are set on exchanges duringwhen messageconsuming transportmessages.
{div:class=confluenceTableSmall}
|| Property || Value ||
| {{rabbitmq.ROUTING_KEY}} |  |
| {{rabbitmq.EXCHANGE_NAME}} |  |
| {{rabbitmq.DELIVERY_TAG}} |  |
{div}

The following headers are used by the producer. If these are set on the camel exchange then they will be set on the RabbitMQ message.
{div:class=confluenceTableSmall}
|| Property || Value ||
| {{rabbitmq.CONTENTROUTING_TYPEKEY}} |  |
| {{rabbitmq.PRIORITYEXCHANGE_NAME}} |  |
| {{rabbitmq.DELIVERY_TAGCONTENT_TYPE}} |  |
| {{rabbitmq.PRIORITY}} | ) |
| {{rabbitmq.CORRELATIONID}} | ) |
| {{rabbitmq.MESSAGE_ID}} | ) |
| {{rabbitmq.DELIVERY_MODE}} | ) |
| {{rabbitmq.USERID}} | ) |
| {{rabbitmq.CLUSTERID}} | ) |
| {{rabbitmq.REPLY_TO}} | ) |
| {{rabbitmq.CONTENT_ENCODING}} | ) |
| {{rabbitmq.TYPE}} | ) |
| {{rabbitmq.EXPIRATION}} | ) |
| {{rabbitmq.TIMESTAMP}} | ) |
| {{rabbitmq.APP_ID}} | ) |
{div}

Headers are set by the consumer once the message is received. The producer will also set the headers for downstream processors once the exchange has taken place. Any headers set prior to production that the producer sets will be overriden.

h3. Message Body

The component will use the camel exchange in body as the rabbit mq message body. The camel exchange in object must be convertible to a byte array. Otherwise the producer will throw an exception of unsupported body type.

h3. Samples

... to be completed