RabbitMQ component
The RabbitMQ component is able to connect to RabbitMQ brokers. It can either act as an inbound (consuming queued messages) or outbound component (adding messages a to queue).
When it is not the first component in a flow it acts as an outbound component (adding messages to a queue) by default.
- In outbound mode, the RabbitMQ component will connect to the broker the first time it needs to send a message.
- In inbound mode, the RabbitMQ component will connect to the broker upon installation and will attempt to restore the connection when it is lost (due to broker restart, network error, etc.).
Configuration
The RabbitMQ component has the following configuration options:
Force inbound
This option is only available when the RabbitMQ component is not the first component in a flow. It overrules the default outbound behaviour (adding messages a to queue) and forces the component into inbound mode (consuming queued messages).
When the route is followed, only one message at a time is consumed if the component is forced into inbound mode.
The body of the message before the RabbitMQ component will be replaced with the body of the consumed message. The headers of the consumed message will be added to the headers as they existed in the message before the RabbitMQ 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
Specify the host (URL or IP address) of the RabbitMQ broker instance, e.g. rabbit.example.org
or 149.210.209.32
.
Virtual host
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
Specify the port on which the broker is listening on the host. By default this is 5672
.
Username
Specify the username of a user that can perform the desired actions.
Password
Specify the password of a user that can perform the desired actions.
Exchange type
Specify the type of the exchange.
Options
Direct
(default)Topic
Fanout
Headers
Direct
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 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.
Topic
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 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.
Fanout
A fanout exchange doesn't use the routing key like the direct exchange. It will sent a copy of received messages to all queues that are bound to it.
Headers
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
Specify the name of the exchange. This can also be an exchange that doesn't exist on the broker yet.
You can override this option by setting a header named rabbitmq.EXCHANGE_OVERRIDE_NAME
before the RabbitMQ component. This is only possible in outbound or forced inbound mode.
Routing key
Specify the routing key that determines to which queue(s) the messages will be routed.
This option is not available when the Exchange type option is set to Fanout
or Headers
.
You can override this option by setting a header named rabbitmq.ROUTING_KEY
before the RabbitMQ component. This is only possible in outbound or forced inbound mode.
Queue name
Specify the name of the queue that will be bound to the exchange. The queue will be created if it doesn't already exist.
Auto delete exchange?
Specify wether the exchange should be deleted when it is no longer in use.
New exchanges will be created on the broker with the Auto Delete
setting set to the specified value. For existing exchanges, this option should match the Auto Delete
setting on the broker's exchange.
When you specify a Queue name that doesn't exist yet, it will be created on the broker with the Auto Delete setting set to the specified value.
Durable exchange?
Specify wether the exchange should survive a restart of the RabbitMQ broker.
New exchanges will be created on the broker with the Durable
setting set to the specified value. For existing exchanges, this option should match the Durable
setting on the broker's exchange.
When you specify a Queue name that doesn't exist yet, it will be created on the broker with the Durable setting set to the specified value.
Use error route?
By default the RabbitMQ component will route failed exchanges to the Error Route when it is in inbound mode. Disable this option if you want to ignore errors that occur while consuming messages. Errors are still logged in the flow logs.
Options
Yes
(default)No
Only available when the component is set to inbound mode.
Exchange pattern
Specify the exchange pattern, It behaves differently in outbound, inbound and force inbound mode.
Options
One way
Request reply
(default)
Outbound mode
Request reply
will cause the component to wait until the message is consumed from the queue to which it was send. This ensures the message has been processed, but may be slower when sending many messages.
If there are no consumers on the queue that receives the messages, the component will wait until the message is received, throwing a timeout exception if this exceeds the time specified in the flow's Components Timeout setting.
One way
simply sends messages to the broker without waiting for them to be consumed. This is ideal when sending a lot of messsages or when the queue doesn't have any consumers.
Inbound mode
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 mode.
Forced inbound mode
When force inbound is enabled, this option is not relevant and will be hidden.
Message headers
The RabbitMQ component sets some headers on the exchange. They are different for each mode of the component.
(Force) Inbound
Header name | Value |
---|---|
rabbitmq.ROUTING_KEY | The 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_NAME | The exchange the message was received from |
rabbitmq.DELIVERY_TAG | The rabbitmq delivery tag of the received message |
rabbitmq.REDELIVERY_TAG | Whether the message is redelivered |
rabbitmq.REQUEUE | 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. |
Outbound
Header name | Value |
---|---|
rabbitmq.ROUTING_KEY | The routing key that will be used when sending the message. Will overwrite the configured routing key option in component. |
rabbitmq.EXCHANGE_NAME | The exchange the message was received from. Will be set on the exchange after the message was sent to the broker. |
rabbitmq.EXCHANGE_OVERRIDE_NAME | Used for force sending the message to this RabbitMQ exchange instead of the configured exchange name in the component. |
rabbitmq.CONTENT_TYPE | The contentType to set on the RabbitMQ message. |
rabbitmq.PRIORITY | The priority header to set on the RabbitMQ message. |
rabbitmq.CORRELATIONID | The correlationId to set on the RabbitMQ message. |
rabbitmq.MESSAGE_ID | The message id to set on the RabbitMQ message. |
rabbitmq.DELIVERY_MODE | If the message should be persistent or not. |
rabbitmq.USERID | The userId to set on the RabbitMQ message. |
rabbitmq.CLUSTERID | The clusterId to set on the RabbitMQ message. |
rabbitmq.REPLY_TO | The replyTo to set on the RabbitMQ message. |
rabbitmq.CONTENT_ENCODING | The contentEncoding to set on the RabbitMQ message. |
rabbitmq.TYPE | The type to set on the RabbitMQ message. |
rabbitmq.EXPIRATION | The expiration to set on the RabbitMQ message. |
rabbitmq.TIMESTAMP | The timestamp to set on the RabbitMQ message. |
rabbitmq.APP_ID | The appId to set on the RabbitMQ message. |