Skip to main content
Version: 4.16.0

RabbitMQ component

The RabbitMQ component is able to connect to RabbitMQ brokers as an inbound component (consuming messages), force inbound component and as an outbound component (adding messages to queues).

Configuration

The RabbitMQ component has the following configuration options:

Force inbound

Description

Settings this to Yes will force the component to turn from outbound to inbound and consume a message from an exchange/queue. This has the same behavior as putting the component below an Enrich component that is set to Override. This means that the current body will be overridden with the new body of the consumed message.

Remarks

  • Only available when component is outbound.
  • Only one message will be consumed when the component is forced to be inbound.
  • This option only becomes visible when another component is connected on the left side of this component.
  • When there are no messages to be consumed, the component will wait for 5 seconds until a message can be consumed. When there is no message within 5 seconds the body will become null and the message will be routed to the next component.

Host

Description

The host name of the RabbitMQ broker instance.

Virtual host

Description

RabbitMQ is multi-tenant system: connections, exchanges, queues, bindings, user permissions, policies and some other things belong to virtual hosts, logical groups of entities. By default the default virtual host / of RabbitMQ is used.

Port

Description

The TCP/IP port on which the broker is listening on the host. By default this is 5672.

Username

Description

Specify the username of a user that can perform the desired actions.

Password

Description

Specify the password of a user that can perform the desired actions.

Exchange type

Options

  • Direct (default)
  • Topic
  • Fanout
  • Headers

Description

Specify the type of the exchange.

A direct exchange will direct the messages to the queue that is bound to it. When a direct exchange has multiple queues bound to it, the routing key option affects to which queue the message will be directed. It should be exactly the same as the routing keys that are specified for the queue. All queues with the same routing key will receive the messages in parallel.

A topic exchange is a bit like the direct type, but more advanced. It makes it possible to use patterns in the routing keys that are bound to queues. In this case the routing key option should be a list of words separated by dots like stock.usd.nyse. The exchange will compare the given routing key of a message with the routing key patterns defined on its bound queues. Queues with matching routing key patterns will receive the message in parallel.

A fanout exchange doesn't use the routing key option like the direct exchange. It will sent a copy of received messages to all queues that are bound to it.

A headers exchange is similar to a topic exchange, but the routing key is ignored. Instead it will use the message headers to compare it to the arguments specified on the exchange. Bound queues with matching arguments will receive the message in parallel.

Exchange name

Description

Specify the name of the exchange. This can also be an exchange that doesn't exist on the broker yet.

Remarks

  • This option can be overridden by the header called rabbitmq.EXCHANGE_OVERRIDE_NAME when the component is outboound or force inbound.

Routing key

Description

Specify the routing key that determines to which queue(s) the messages will be routed.

Remarks

  • This option is not available when the Exchange type option is set to Fanout or Headers.
  • Can also be set with the header called rabbitmq.ROUTING_KEY when the component is outbound or force inbound.

Queue name

Description

Specify a queue name that will be bound to the exchange. The queue will be created if it doesn't exist yet.

Auto delete exchange?

Description

Specify if the exchange should be deleted when it is no longer in use.

Remarks

  • New exchanges will be created on the broker with the Auto delete setting set to the specified value.
  • For existing exchanges this option should have the same value as the Auto delete setting on the exchange of the broker.
  • When you specified a Queue that doesn't exist yet it will be created on the broker with the Auto delete setting set to the specified value.

Durable exchange?

Description

Specify if the exchange should survive a restart of the RabbitMQ broker.

Remarks

  • New exchanges will be created on the broker with the Durable setting set to the specified value.
  • For existing exchanges this option should have the same value as the Durable setting on the exchange of the broker.
  • When you specified a Queue name that doesn't exist yet it will be created on the broker with the Durable setting set to the specified value.

Exchange pattern

Options

  • One way
  • Request reply (default)

Description

Specify the exchange pattern which has different effects for inbound and outbound behaviour.

When the component is outbound, then this option determines the throughput of the messages to the broker. Request reply will let the component wait till the message is consumed from the queue that it was send to. This will guarantee that the message has been processed, but can be slower when sending many messages to the broker. When there are no consumers on the queue that receives the messages the component will wait till the message is received and throw a timeout exception when this takes longer then the specified components timeout. One way just sends the messages to the broker without waiting for it to be consumed. This is ideal when sending a lot of messsages or when the queue doesn't have any consumers.

When the component is inbound, then this option sets the selected exchange pattern on the message that will be routed to the rest of the flow. In most cases One way is the best choice for inbound.

When the component has force inbound enabled then this option is not relevant and is hidden.

Use error route

Options

  • Yes (default)
  • No

Description

By default the component will route errors to the error route when it is inbound. Set to No when you want to ignore errors that occur while consuming messages. They are still logged in the flow logging.

Remarks

  • Only available when the component is inbound.

Message headers

The RabbitMQ component sets some headers on the exchange. They are different for each mode of the component.

(Force) inbound

PropertyValue
rabbitmq.ROUTING_KEYThe routing key that was used to receive the message, or the routing key that will be used when producing a message. Remove this header when there is also a outbound component in the flow that needs a different routing key.
rabbitmq.EXCHANGE_NAMEThe exchange the message was received from
rabbitmq.DELIVERY_TAGThe rabbitmq delivery tag of the received message
rabbitmq.REDELIVERY_TAGWhether the message is redelivered
rabbitmq.REQUEUEThis 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.

Outbound

PropertyValue
rabbitmq.ROUTING_KEYThe routing key that will be used when sending the message. Will overwrite the configured routing key option in component.
rabbitmq.EXCHANGE_NAMEThe exchange the message was received from. Will be set on the exchange after the message was sent to the broker.
rabbitmq.EXCHANGE_OVERRIDE_NAMEUsed for force sending the message to this RabbitMQ exchange instead of the configured exchange name in the component.
rabbitmq.CONTENT_TYPEThe contentType to set on the RabbitMQ message.
rabbitmq.PRIORITYThe priority header to set on the RabbitMQ message.
rabbitmq.CORRELATIONIDThe correlationId to set on the RabbitMQ message.
rabbitmq.MESSAGE_IDThe message id to set on the RabbitMQ message.
rabbitmq.DELIVERY_MODEIf the message should be persistent or not.
rabbitmq.USERIDThe userId to set on the RabbitMQ message.
rabbitmq.CLUSTERIDThe clusterId to set on the RabbitMQ message.
rabbitmq.REPLY_TOThe replyTo to set on the RabbitMQ message.
rabbitmq.CONTENT_ENCODINGThe contentEncoding to set on the RabbitMQ message.
rabbitmq.TYPEThe type to set on the RabbitMQ message.
rabbitmq.EXPIRATIONThe expiration to set on the RabbitMQ message.
rabbitmq.TIMESTAMPThe timestamp to set on the RabbitMQ message.
rabbitmq.APP_IDThe appId to set on the RabbitMQ message.

Remarks

  • All the settings of this component support simple expressions so that you can use headers to set dynamic values.
  • When the component is inbound it will connect to the broker on installation and it will try to restore the connection when it is lost (broker restart, network error, etc.).
  • When the component is outbound it wil connect to the broker the first time it has to send a message.