Document toolboxDocument toolbox

Rabbit Receiver

Description

A unit that receives items from RabbitMQ message-broker queues.

RabbitMQ uses a fixed set of queues, provided in the unit settings, and dynamic sets of queues, managed by input events to add and remove input ports. These two sets are disjoint, within different namespaces. Therefore, you cannot remove a static queue using input events. To use the same values both, set them in the default tab.

Each queue has an identifying key, unique within its namespace (configuration or events).

When using a fixed set of queues, data arrives from the RabbitMQ queue and is processed according to the unit settings. If successful, a pilot event with fields defined by the output event settings is emitted through the data port.
If an error occurs, a pilot event with standard error fields is emitted through the error port.

When using dynamic queue set management, on receiving an input event via the add input port, a new queue is created using the settings entered in the event fields.

By default, event field names correspond to configuration item names. If you want a different mapping, you can set this in the input events tab.

On receiving an input event via the remove input port, the corresponding queue will be deleted. On receiving an input event via the removeAll input port, all dynamically created queues will be deleted.

In both cases:
Successful input events will be enriched with an action field corresponding to the action performed, and are emitted through the done output port.
If the action failed, the input events will be enriched with an action field as well as standard error fields, and are emitted through the fail output port.

Configuration

After dragging this unit into the Flow canvas, double-click it to access its configuration options. The following table describes the configuration options of this unit:

Tab

Field

Description

Tab

Field

Description

General

Name

Enter a name for the unit. It must start with a letter, and cannot contain spaces. Only letters, numbers, and underscores are allowed.

Description

Enter a description detailing the scope of the unit.

Status queues

Queue

Click the plus icon to add queue settings.

You can collapse and expand the queues using the  icon, reorder using the arrows, or delete using the X icon.

You can also reorder the fields using drag and drop.

Key

Enter the key to identify a queue within its namespace

Source

The source of the messages (a queue or an exchange). If an exchange is given, a temporary queue will be created.

Is exchange

Whether the selected source is an exchange (true) or a queue (false).

Routing key

Enter the label to describe the message. Only applies when the source is an exchange.

Host

Enter the host to use for establishing the initial connection to RabbitMQ.

Virtual host

Enter the name of the virtual host used to configure RabbitMQ instances.

Port

Enter the name of the port used for establishing a connection to RabbitMQ.

Username

Specify the client name to access RabbitMQ.

Password

Enter the password requested to access RabbitMQ.

Connection timeout

The maximum amount of time (in milliseconds) to maintain the connection.

Requested heartbeat

Indicate how often (in milliseconds) to send signals to indicate normal operation in order to maintain the connection alive.

Zero for no heartbeat.

Auto ack

Whether to acknowledge queue items after extracting them from the queue. If false, you will have to send acks later using an mq.RabbitAck unit.

Charset

Indicate the encoding system to use for the message text.

Input events

Key

Enter the name of an input event field containing a key setting.

Host

Enter the name of an input event field containing the host setting.

Virtual host

Enter the name of an input event field containing virtual host setting.

Port

Enter the name of an input event field containing the port setting.

Username

Enter the name of an input event field containing the username setting.

Password

Enter the name of an input event field containing password setting.

Connection timeout

Enter the name of an input event field containing the connection timeout setting.

Requested heartbeat

Enter the name of an input event field containing the requested heartbeat setting.

Charset

Enter the name of an input event field containing the charset setting.

Source

Enter the name of an input event field containing the source setting.

Is exchange

Enter the name of an input event field containing the is exchange setting.

Routing key

Enter the name of an input event field containing the routing key setting.

Auto Ack

Enter the name of an input event field containing the autoAck setting.

Defaults

The fields in this tab are identical the fixed and dynamic queue settings. Here you can enter default values to be applied to both.

Output events

Channel

Enter a name for the output event field containing the channel.

Delivery tag

Enter a name for the output event field containing the delivery tag.

Exchange

Enter a name for the output event field containing the exchange.

Routing key

Enter a name for the output event field containing the routing key setting.

Body

Enter a name for the output event field containing the body of the message.

Input ports

Port

Description

Port

Description

add

Input events to request a new queue to be added. Must have at least a field specifying the queue key.

remove

Input events to remove a previously added queue. Must have at least a field specifying the queue key.

removeAll

Input events to remove all previously added queues. No fields needed.

Output ports

Port

Description

Port

Description

data

Output events for successful RabbitMQ messages. The structure is defined by the output event settings.

error

Output events for failed RabbitMQ messages, enriched with standard error fields. 

done

Output events for successful queue manipulation actions, enriched with an action field specifying the action performed.

fail

Output events for failed queue manipulation actions, enriched with an action field and standard error fields.

Example

In this example, we want to write events into a RabbitMQ queue.

First, add a Tick unit to fire events every time it is clicked. In the Fields tab of the properties, configure a string to send to the Rabbit Sender:

Then, add the Rabbit Sender unit to the Flow and link it to the Tick unit.

In the properties, we need to enter the host to use for establishing the initial connection to RabbitMQ, as well as the following information:

After saving and starting the Flow, you must click the red button of the Tick unit to begin sending events.

Download this example

You can try this flow by downloading this JSON file and uploading it to your domain using the Import option: