RabbitMQ
Since Camel 2.12
Both producer and consumer are supported
The RabbitMQ component allows you to produce and consume messages from RabbitMQ instances. Using the RabbitMQ AMQP client, this component offers a pure RabbitMQ approach over the generic AMQP component.
It is recommended to use the Camel Spring RabbitMQ component, instead of using this component. |
Maven users will need to add the following dependency to their pom.xml
for this component:
<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>
URI format
rabbitmq:exchangeName?[options]
The exchange name determines the exchange to which the produced messages will be sent to. In the case of consumers, the exchange name determines the exchange the queue will be bound to.
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
The component level is the highest level which holds general and common configurations that are inherited by the endpoints. For example a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
Configuring components can be done with the Component DSL, in a configuration file (application.properties|yaml), or directly with Java code.
Configuring Endpoint Options
Where you find yourself configuring the most is on endpoints, as endpoints often have many options, which allows you to configure what you need the endpoint to do. The options are also categorized into whether the endpoint is used as consumer (from) or as a producer (to), or used for both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders, which allows to not hardcode urls, port numbers, sensitive information, and other settings. In other words placeholders allows to externalize the configuration from your code, and gives more flexibility and reuse.
The following two sections lists all the options, firstly for the component followed by the endpoint.
Component Options
The RabbitMQ component supports 56 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
If this option is set, camel-rabbitmq will try to create connection based on the setting of option addresses. The addresses value is a string which looks like server1:12345, server2:12345. | String | ||
If it is true, the exchange will be deleted when it is no longer in use. | true | boolean | |
To use a custom RabbitMQ connection factory. When this option is set, all connection options (connectionTimeout, requestedChannelMax…) set on URI are not used. | ConnectionFactory | ||
The name of the dead letter exchange. | String | ||
The type of the dead letter exchange. Enum values:
| direct | String | |
The name of the dead letter queue. | String | ||
The routing key for the dead letter exchange. | String | ||
If the option is true, camel declare the exchange and queue name and bind them together. If the option is false, camel won’t declare the exchange and queue name on the server. | true | boolean | |
If we are declaring a durable exchange (the exchange will survive a server restart). | true | boolean | |
Exclusive queues may only be accessed by the current connection, and are deleted when that connection closes. | false | boolean | |
The hostname of the running RabbitMQ instance or cluster. | String | ||
Passive queues depend on the queue already to be available at RabbitMQ. | false | boolean | |
Port number for the host with the running rabbitmq instance or cluster. | 5672 | int | |
This can be used if we need to declare the queue but not the exchange. | false | boolean | |
If true the queue will not be bound to the exchange after declaring it. | false | boolean | |
If true the producer will not declare and bind a queue. This can be used for directing messages via an existing routing key. | false | boolean | |
The vhost for the channel. | / | String | |
If messages should be auto acknowledged. | true | boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
Request exclusive access to the queue (meaning only this consumer can access the queue). This is useful when you want a long-lived shared queue to be temporarily accessible by just one consumer. | false | boolean | |
The maximum number of messages that the server will deliver, 0 if unlimited. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | int | ||
Enables the quality of service on the RabbitMQConsumer side. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | false | boolean | |
If the settings should be applied to the entire channel rather than each consumer You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | false | boolean | |
The maximum amount of content (measured in octets) that the server will deliver, 0 if unlimited. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | int | ||
Decides whether an exception during declaration of exchanges or queues is recoverable or not. If the option is false, camel will throw an exception when starting the consumer, which will interrupt application startup (e.g. in the case when the exchange / queue is already declared in RabbitMQ and has incompatible configuration). If set to true, the consumer will try to reconnect periodically. | false | boolean | |
The consumer uses a Thread Pool Executor with a fixed number of threads. This setting allows you to set that number of threads. | 10 | int | |
Map of additional headers. These headers will be set only when the 'allowCustomHeaders' is set to true. | Map | ||
Map of additional properties. These are standard RabbitMQ properties as defined in com.rabbitmq.client.AMQP.BasicProperties The map keys should be from org.apache.camel.component.rabbitmq.RabbitMQConstants. Any other keys will be ignored. When the message already contains these headers they will be given precedence over these properties. | Map | ||
Allow pass null values to header. | false | boolean | |
Get maximum number of opened channel in pool. | 10 | int | |
Set the maximum number of milliseconds to wait for a channel from the pool. | 1000 | long | |
When true, an exception will be thrown when the message cannot be delivered (basic.return) and the message is marked as mandatory. PublisherAcknowledgement will also be activated in this case. See also publisher acknowledgements - When will messages be confirmed. | false | boolean | |
This flag tells the server how to react if the message cannot be routed to a queue consumer immediately. If this flag is set, the server will return an undeliverable message with a Return method. If this flag is zero, the server will queue the message, but with no guarantee that it will ever be consumed. If the header is present rabbitmq.IMMEDIATE it will override this option. | false | boolean | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
This flag tells the server how to react if the message cannot be routed to a queue. If this flag is set, the server will return an unroutable message with a Return method. If this flag is zero, the server silently drops the message. If the header is present rabbitmq.MANDATORY it will override this option. | false | boolean | |
When true, the message will be published with publisher acknowledgements turned on. | false | boolean | |
The amount of time in milliseconds to wait for a basic.ack response from RabbitMQ server. | long | ||
Specify arguments for configuring the different RabbitMQ concepts, a different prefix is required for each: Exchange: arg.exchange. Queue: arg.queue. Binding: arg.binding. DLQ: arg.dlq.queue. DLQ Binding: arg.dlq.binding. For example to declare a queue with message ttl argument: http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000. | Map | ||
Whether to auto-detect looking up RabbitMQ connection factory from the registry. When enabled and a single instance of the connection factory is found then it will be used. An explicit connection factory can be configured on the component or endpoint level which takes precedence. | true | boolean | |
Enables connection automatic recovery (uses connection implementation that performs automatic recovery when connection shutdown is not initiated by the application). | Boolean | ||
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | |
Connection client properties (client info used in negotiating with the server). | Map | ||
Custom rabbitmq ExceptionHandler for ConnectionFactory. | ExceptionHandler | ||
Connection timeout. | 60000 | int | |
Network recovery interval in milliseconds (interval used when recovering from network failure). | 5000 | Integer | |
Connection requested channel max (max number of channels offered). | 2047 | int | |
Connection requested frame max (max size of frame offered). | 0 | int | |
Connection requested heartbeat (heart-beat in seconds offered). | 60 | int | |
Set timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds). | 20000 | long | |
Set requestTimeoutCheckerInterval for inOut exchange. | 1000 | long | |
Enables connection topology recovery (should topology recovery be performed). | Boolean | ||
When true and an inOut Exchange failed on the consumer side send the caused Exception back in the response. | false | boolean | |
Password for authenticated access. | guest | String | |
Enables SSL on connection, accepted value are true, TLS and 'SSLv3. | String | ||
Configure SSL trust manager, SSL should be enabled for this option to be effective. | TrustManager | ||
Username in case of authenticated access. | guest | String |
Endpoint Options
The RabbitMQ endpoint is configured using URI syntax:
rabbitmq:exchangeName
with the following path and query parameters:
Query Parameters (66 parameters)
Name | Description | Default | Type |
---|---|---|---|
If this option is set, camel-rabbitmq will try to create connection based on the setting of option addresses. The addresses value is a string which looks like server1:12345, server2:12345. | String | ||
If it is true, the exchange will be deleted when it is no longer in use. | true | boolean | |
Enables connection automatic recovery (uses connection implementation that performs automatic recovery when existing connection has failures). | true | Boolean | |
To use a custom RabbitMQ connection factory. When this option is set, all connection options (connectionTimeout, requestedChannelMax…) set on URI are not used. | ConnectionFactory | ||
The name of the dead letter exchange. | String | ||
The type of the dead letter exchange. Enum values:
| direct | String | |
The name of the dead letter queue. | String | ||
The routing key for the dead letter exchange. | String | ||
If the option is true, camel declare the exchange and queue name and bind them together. If the option is false, camel won’t declare the exchange and queue name on the server. | true | boolean | |
If we are declaring a durable exchange (the exchange will survive a server restart). | true | boolean | |
The exchange type such as direct or topic. Enum values:
| direct | String | |
Exclusive queues may only be accessed by the current connection, and are deleted when that connection closes. | false | boolean | |
The hostname of the running rabbitmq instance or cluster. | String | ||
Passive queues depend on the queue already to be available at RabbitMQ. | false | boolean | |
Port number for the host with the running rabbitmq instance or cluster. Default value is 5672. | int | ||
The queue to receive messages from. | String | ||
The routing key to use when binding a consumer queue to the exchange. For producer routing keys, you set the header rabbitmq.ROUTING_KEY. | String | ||
If true the producer will not declare and bind a dead letter queue. This can be used if you have also DLQ rabbitmq consumer and you want to avoid argument clashing between Producer and Consumer. This option have no effect, if DLQ configured (deadLetterExchange option is not set). | false | boolean | |
This can be used if we need to declare the queue but not the exchange. | false | boolean | |
If true the queue will not be bound to the exchange after declaring it. | false | boolean | |
If true the producer will not declare and bind a queue. This can be used for directing messages via an existing routing key. | false | boolean | |
The vhost for the channel. | / | String | |
If messages should be auto acknowledged. | true | boolean | |
Number of concurrent consumers when consuming from broker. (eg similar as to the same option for the JMS component). | 1 | int | |
Specify a client-generated consumer tag to establish context when invoking the consume operation. | String | ||
Request exclusive access to the queue (meaning only this consumer can access the queue). This is useful when you want a long-lived shared queue to be temporarily accessible by just one consumer. | false | boolean | |
The maximum number of messages that the server will deliver, 0 if unlimited. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | int | ||
Enables the quality of service on the RabbitMQConsumer side. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | false | boolean | |
If the settings should be applied to the entire channel rather than each consumer You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | false | boolean | |
The maximum amount of content (measured in octets) that the server will deliver, 0 if unlimited. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | int | ||
Decides whether an exception during declaration of exchanges or queues is recoverable or not. If the option is false, camel will throw an exception when starting the consumer, which will interrupt application startup (e.g. in the case when the exchange / queue is already declared in RabbitMQ and has incompatible configuration). If set to true, the consumer will try to reconnect periodically. | true | boolean | |
This is used by the consumer to control rejection of the message. When the consumer is complete processing the exchange, and if the exchange failed, then the consumer is going to reject the message from the RabbitMQ broker. If the header CamelRabbitmqRequeue is present then the value of the header will be used, otherwise this endpoint value is used as fallback. If the value is false (by default) then the message is discarded/dead-lettered. If the value is true, then the message is re-queued. | false | boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
The consumer uses a Thread Pool Executor with a fixed number of threads. This setting allows you to set that number of threads. | 10 | int | |
Map of additional headers. These headers will be set only when the 'allowCustomHeaders' is set to true. | Map | ||
Map of additional properties. These are standard RabbitMQ properties as defined in com.rabbitmq.client.AMQP.BasicProperties. The map keys should be from org.apache.camel.component.rabbitmq.RabbitMQConstants. Any other keys will be ignored. | Map | ||
Allow pass custom values to header. | false | boolean | |
Allow pass null values to header. | false | boolean | |
If the bridgeEndpoint is true, the producer will ignore the message header of rabbitmq.EXCHANGE_NAME and rabbitmq.ROUTING_KEY. | false | boolean | |
Get maximum number of opened channel in pool. | 10 | int | |
Set the maximum number of milliseconds to wait for a channel from the pool. | 1000 | long | |
When true, an exception will be thrown when the message cannot be delivered (basic.return) and the message is marked as mandatory. PublisherAcknowledgement will also be activated in this case. See also publisher acknowledgements - When will messages be confirmed. | false | boolean | |
This flag tells the server how to react if the message cannot be routed to a queue consumer immediately. If this flag is set, the server will return an undeliverable message with a Return method. If this flag is zero, the server will queue the message, but with no guarantee that it will ever be consumed. If the header is present rabbitmq.IMMEDIATE it will override this option. | false | boolean | |
This flag tells the server how to react if the message cannot be routed to a queue. If this flag is set, the server will return an unroutable message with a Return method. If this flag is zero, the server silently drops the message. If the header is present rabbitmq.MANDATORY it will override this option. | false | boolean | |
When true, the message will be published with publisher acknowledgements turned on. | false | boolean | |
The amount of time in milliseconds to wait for a basic.ack response from RabbitMQ server. | long | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether to allow Java serialization of the message body or not. If this value is true, the message body will be serialized on the producer side using Java serialization, if no type converter can handle the message body. On the consumer side, it will deserialize the message body if this value is true and the message contains a CamelSerialize header. Setting this value to true may introduce a security vulnerability as it allows an attacker to attempt to deserialize to a gadget object which could result in a RCE or other security vulnerability. | false | boolean | |
Specify arguments for configuring the different RabbitMQ concepts, a different prefix is required for each: Exchange: arg.exchange. Queue: arg.queue. Binding: arg.binding. DLQ: arg.dlq.queue. DLQ binding: arg.dlq.binding. For example to declare a queue with message ttl argument: http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000. | Map | ||
Connection client properties (client info used in negotiating with the server). | Map | ||
Custom rabbitmq ExceptionHandler for ConnectionFactory. | ExceptionHandler | ||
Connection timeout. | 60000 | int | |
Network recovery interval in milliseconds (interval used when recovering from network failure). | 5000 | Integer | |
Connection requested channel max (max number of channels offered). | 2047 | int | |
Connection requested frame max (max size of frame offered). | 0 | int | |
Connection requested heartbeat (heart-beat in seconds offered). | 60 | int | |
Set timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds). | 20000 | long | |
Set requestTimeoutCheckerInterval for inOut exchange. | 1000 | long | |
Enables connection topology recovery (should topology recovery be performed). | Boolean | ||
When true and an inOut Exchange failed on the consumer side send the caused Exception back in the response. | false | boolean | |
Password for authenticated access. | guest | String | |
Enables SSL on connection, accepted value are true, TLS and 'SSLv3. | String | ||
Configure SSL trust manager, SSL should be enabled for this option to be effective. | TrustManager | ||
Username in case of authenticated access. | guest | String |
Using a connection factory
To connect to RabbitMQ you can setup a ConnectionFactory
(same as with JMS) with the login details such as:
<bean id="rabbitConnectionFactory" class="com.rabbitmq.client.ConnectionFactory">
<property name="host" value="localhost"/>
<property name="port" value="5672"/>
<property name="username" value="camel"/>
<property name="password" value="bugsbunny"/>
</bean>
And then refer to the connection factory in the endpoint uri as shown below:
<camelContext>
<route>
<from uri="direct:rabbitMQEx2"/>
<to uri="rabbitmq:ex2?connectionFactory=#rabbitConnectionFactory"/>
</route>
</camelContext>
The ConnectionFactory
is auto-detected by default, so you can just do
<camelContext>
<route>
<from uri="direct:rabbitMQEx2"/>
<to uri="rabbitmq:ex2"/>
</route>
</camelContext>
In case you have multiple connection factories in your application or multiple connection factories in your registry, don’t forget to set the autoDetectConnectionFactory
to false.
Message Headers
The RabbitMQ component supports 23 message header(s), which is/are listed below:
Name | Description | Default | Type |
---|---|---|---|
CamelRabbitmqRoutingKey (common) Constant: | Consumer: The routing key that was used to receive the message, or the routing key that will be used when producing a message Producer: The routing key that will be used when sending the message. | String | |
CamelRabbitmqExchangeOverrideName (common) Constant: | Used for force sending the message to this exchange instead of the endpoint configured name on the producer. | String | |
CamelRabbitmqExchangeName (common) Constant: | Consumer: The exchange the message was received from Producer: The exchange the message was received from. | String | |
CamelRabbitmqContentType (common) Constant: | The contentType to set on the RabbitMQ message. | String | |
CamelRabbitmqPriority (common) Constant: | The priority header to set on the RabbitMQ message. | int | |
CamelRabbitmqDeliveryTag (common) Constant: | The rabbitmq delivery tag of the received message. | long | |
CamelRabbitmqRedeliveryTag (common) Constant: | Whether the message is a redelivered. | boolean | |
CamelRabbitmqCorrelationId (common) Constant: | The correlationId to set on the RabbitMQ message. | String | |
CamelRabbitmqMessageId (common) Constant: | The message id to set on the RabbitMQ message. | String | |
CamelRabbitmqDeliveryMode (common) Constant: | If the message should be persistent or not. | Integer | |
Constant: | The userId to set on the RabbitMQ message. | String | |
CamelRabbitmqClusterId (common) Constant: | The clusterId to set on the RabbitMQ message. | String | |
CamelRabbitmqRequestTimeout (common) Constant: | The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds). | long | |
Constant: | The replyTo to set on the RabbitMQ message. | String | |
CamelRabbitmqContentEncoding (common) Constant: | The contentEncoding to set on the RabbitMQ message. | String | |
Constant: | The type to set on the RabbitMQ message. | String | |
CamelRabbitmqExpiration (common) Constant: | The expiration to set on the RabbitMQ message. | String | |
CamelRabbitmqTimestamp (common) Constant: | The timestamp to set on the RabbitMQ message. | Date | |
Constant: | The appId to set on the RabbitMQ message. | String | |
Constant: | This is used by the consumer to control rejection of the message. When the consumer is complete processing the exchange, and if the exchange failed, then the consumer is going to reject the message from the RabbitMQ broker. The value of this header controls this behavior. If the value is false (by default) then the message is discarded/dead-lettered. If the value is true, then the message is re-queued. | boolean | |
CamelRabbitmqMandatory (common) Constant: | The flag telling the server how to react if the message cannot be routed to a queue. | Boolean | |
CamelRabbitmqImmediate (common) Constant: | The flag telling the server how to react if the message cannot be routed to a queue consumer immediately. | Boolean | |
CamelMessageTimestamp (common) Constant: | The timestamp of the RabbitMQ message. | long |
Troubleshooting headers
Watch out when consuming from a RabbitMq queue and producing to the same RabbitMq exchange. The header details on the exchange may be populated with headers that will not be overriden by the destination endpoint. The following example will help understand the pitfall.
from("rabbitmq:A?queue=IN&declare=false&autoDelete=false&arg.queue.x-message-ttl=20000")
// ... your route
.to("rabbitmq:A?queue=OUT&routingKey=OUT&declare=false&autoDelete=false&arg.queue.x-message-ttl=20000");
You would think that it would be a straight forward operation. However, if the source queue has a routing key set in the headers, it will pass down to the destination and not be overriden with the URI query parameters. Because the exchange is the same and the routing key is the same, an infinitely growing loop is created.
Either make a second exchange for the producer to avoid the headers to pass through or manually access the exchange headers in a processor and get rid of the misbehaving key.
from("rabbitmq:A?queue=IN&declare=false&autoDelete=false&arg.queue.x-message-ttl=20000")
// ...
.process(e -> {
InputModel input = e.getMessage().getBody(InputModel.class);
e.getMessage().removeHeader("CamelRabbitmqRoutingKey");
OutputModel output = ...
e.getMessage().setBody(output);
})
// ...
.to("rabbitmq:A?queue=OUT&routingKey=OUT&declare=false&autoDelete=false&arg.queue.x-message-ttl=20000");
Now you are at least guaranteed to not create a loop from the camel route.
Allowing custom Headers
The allowCustomHeaders
endpoint option can be used to avoid adding custom headers to the message sent to RabbitMQ. If set to false, the user will have only CamelRabbitmq* headers in the payload of the message. Default value for this option is true.
If you decide to use the allowCustomHeaders option, don’t add sensitive information as header. It’s not recommended and it’s dangerous. Don’t do it. |
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.
Samples
To receive messages from a queue that is bound to an exchange A with the routing key B,
from("rabbitmq:A?routingKey=B")
.to("log:cheese");
To receive messages from a queue with a single thread with auto acknowledge disabled.
from("rabbitmq:A?routingKey=B&threadPoolSize=1&autoAck=false")
.to("log:cheese");
To send messages to an exchange called C
from("direct:foo")
.to("rabbitmq:C");
Declaring a headers exchange and queue
from("rabbitmq:ex?exchangeType=headers&queue=q&bindingArgs=#bindArgs")
.to("log:cheese");
and place corresponding Map<String, Object>
with the id of "bindArgs" in the Registry.
For example declaring a method in Spring
@Bean(name = "bindArgs")
public Map<String, Object> bindArgsBuilder() {
return new HashMap<String, Object>() {{
put("binding.foo", "bar");
}};
}
Spring Boot Auto-Configuration
When using rabbitmq with Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-rabbitmq-starter</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
The component supports 57 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
Map of additional headers. These headers will be set only when the 'allowCustomHeaders' is set to true. | Map | ||
Map of additional properties. These are standard RabbitMQ properties as defined in com.rabbitmq.client.AMQP.BasicProperties The map keys should be from org.apache.camel.component.rabbitmq.RabbitMQConstants. Any other keys will be ignored. When the message already contains these headers they will be given precedence over these properties. | Map | ||
If this option is set, camel-rabbitmq will try to create connection based on the setting of option addresses. The addresses value is a string which looks like server1:12345, server2:12345. | String | ||
Allow pass null values to header. | false | Boolean | |
Specify arguments for configuring the different RabbitMQ concepts, a different prefix is required for each: Exchange: arg.exchange. Queue: arg.queue. Binding: arg.binding. DLQ: arg.dlq.queue. DLQ Binding: arg.dlq.binding. For example to declare a queue with message ttl argument: http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000. | Map | ||
If messages should be auto acknowledged. | true | Boolean | |
If it is true, the exchange will be deleted when it is no longer in use. | true | Boolean | |
Whether to auto-detect looking up RabbitMQ connection factory from the registry. When enabled and a single instance of the connection factory is found then it will be used. An explicit connection factory can be configured on the component or endpoint level which takes precedence. | true | Boolean | |
Enables connection automatic recovery (uses connection implementation that performs automatic recovery when connection shutdown is not initiated by the application). | Boolean | ||
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean | |
Get maximum number of opened channel in pool. | 10 | Integer | |
Set the maximum number of milliseconds to wait for a channel from the pool. | 1000 | Long | |
Connection client properties (client info used in negotiating with the server). | Map | ||
To use a custom RabbitMQ connection factory. When this option is set, all connection options (connectionTimeout, requestedChannelMax…) set on URI are not used. The option is a com.rabbitmq.client.ConnectionFactory type. | ConnectionFactory | ||
camel.component.rabbitmq.connection-factory-exception-handler | Custom rabbitmq ExceptionHandler for ConnectionFactory. The option is a com.rabbitmq.client.ExceptionHandler type. | ExceptionHandler | |
Connection timeout. | 60000 | Integer | |
The name of the dead letter exchange. | String | ||
The type of the dead letter exchange. | direct | String | |
The name of the dead letter queue. | String | ||
The routing key for the dead letter exchange. | String | ||
If the option is true, camel declare the exchange and queue name and bind them together. If the option is false, camel won’t declare the exchange and queue name on the server. | true | Boolean | |
If we are declaring a durable exchange (the exchange will survive a server restart). | true | Boolean | |
Whether to enable auto configuration of the rabbitmq component. This is enabled by default. | Boolean | ||
Exclusive queues may only be accessed by the current connection, and are deleted when that connection closes. | false | Boolean | |
Request exclusive access to the queue (meaning only this consumer can access the queue). This is useful when you want a long-lived shared queue to be temporarily accessible by just one consumer. | false | Boolean | |
When true, an exception will be thrown when the message cannot be delivered (basic.return) and the message is marked as mandatory. PublisherAcknowledgement will also be activated in this case. See also publisher acknowledgements - When will messages be confirmed. | false | Boolean | |
The hostname of the running RabbitMQ instance or cluster. | String | ||
This flag tells the server how to react if the message cannot be routed to a queue consumer immediately. If this flag is set, the server will return an undeliverable message with a Return method. If this flag is zero, the server will queue the message, but with no guarantee that it will ever be consumed. If the header is present rabbitmq.IMMEDIATE it will override this option. | false | Boolean | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean | |
This flag tells the server how to react if the message cannot be routed to a queue. If this flag is set, the server will return an unroutable message with a Return method. If this flag is zero, the server silently drops the message. If the header is present rabbitmq.MANDATORY it will override this option. | false | Boolean | |
Network recovery interval in milliseconds (interval used when recovering from network failure). | 5000 | Integer | |
Passive queues depend on the queue already to be available at RabbitMQ. | false | Boolean | |
Password for authenticated access. | guest | String | |
Port number for the host with the running rabbitmq instance or cluster. | 5672 | Integer | |
The maximum number of messages that the server will deliver, 0 if unlimited. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | Integer | ||
Enables the quality of service on the RabbitMQConsumer side. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | false | Boolean | |
If the settings should be applied to the entire channel rather than each consumer You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | false | Boolean | |
The maximum amount of content (measured in octets) that the server will deliver, 0 if unlimited. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time. | Integer | ||
When true, the message will be published with publisher acknowledgements turned on. | false | Boolean | |
The amount of time in milliseconds to wait for a basic.ack response from RabbitMQ server. | Long | ||
Decides whether an exception during declaration of exchanges or queues is recoverable or not. If the option is false, camel will throw an exception when starting the consumer, which will interrupt application startup (e.g. in the case when the exchange / queue is already declared in RabbitMQ and has incompatible configuration). If set to true, the consumer will try to reconnect periodically. | false | Boolean | |
Set timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds). | 20000 | Long | |
Set requestTimeoutCheckerInterval for inOut exchange. | 1000 | Long | |
Connection requested channel max (max number of channels offered). | 2047 | Integer | |
Connection requested frame max (max size of frame offered). | 0 | Integer | |
Connection requested heartbeat (heart-beat in seconds offered). | 60 | Integer | |
This can be used if we need to declare the queue but not the exchange. | false | Boolean | |
If true the queue will not be bound to the exchange after declaring it. | false | Boolean | |
If true the producer will not declare and bind a queue. This can be used for directing messages via an existing routing key. | false | Boolean | |
Enables SSL on connection, accepted value are true, TLS and 'SSLv3. | String | ||
The consumer uses a Thread Pool Executor with a fixed number of threads. This setting allows you to set that number of threads. | 10 | Integer | |
Enables connection topology recovery (should topology recovery be performed). | Boolean | ||
When true and an inOut Exchange failed on the consumer side send the caused Exception back in the response. | false | Boolean | |
Configure SSL trust manager, SSL should be enabled for this option to be effective. The option is a javax.net.ssl.TrustManager type. | TrustManager | ||
Username in case of authenticated access. | guest | String | |
The vhost for the channel. | / | String |