Skip to main content
Version: 1.22.3

RabbitMQ Consumer

The SimpleOne system can be configured as a consumer application that can accept messages from third-party services through a connection to the RabbitMQ message broker.

RabbitMQ acts as an intermediary to route messages from the external application to specific queues where the messages are stored until they are delivered to the consumer.

To connect to a specific RabbitMQ queue, create a consumer entry in the system. To do so, complete the following steps:

  1. Navigate to External Queues → RabbitMQ Consumers.
  2. Click New and fill in the required fields.
  3. Click Save or Save and exit to apply the changes.

RabbitMQ Consumer form fields

FieldMandatoryDescription
NameYSpecify a consumer name.
ActiveNSelect the checkbox to activate the consumer record.
Enable debugNSelect the checkbox to enable advanced logs. Use them to identify problems when configuring consumer settings.
Host nameYEnter a RabbitMQ host name to connect to in the example.com format.
PortYSpecify the server connection port.
Virtual hostNSpecify the host designated in the RabbitMQ server settings.
Queue nameYSpecify the name of the queue that you need to receive the messages from.
UsernameYSpecify a user login for the RabbitMQ server connection. Do not use special symbols in usernames to avoid connection failures.
PasswordYSpecify a user password for the RabbitMQ server connection. Do not use special symbols in password to avoid connection failures.
Connection time outNSet the RabbitMQ server connection time out.
Run as userYSelect the user on whose behalf to execute the script.
ScriptYEnter a script that will process received messages and invoke certain actions in the system. The following variables are available in the script:
  • body of type String – the message sent to the queue.
  • headers of type Object – a set of string keys with string values passed in message headers.
Script example
(function(body, headers) {
ss.info(body + JSON.stringify(headers));
})(body, headers)

Consumers do not create queues, they only connect to existing ones. After establishing a connection to the RabbitMQ server, the target queue may be empty. Messages are only delivered when there are new messages in the queue.

Unloading and processing messages do not happen at the same time. The message is read from the outer queue and enters the inner queue, where it waits for its turn to be processed.

note

If the connection to the server is lost, the consumer automatically attempts to restore the connection. The time between the attempts is determined by the Connection time out field and is 30 seconds by default.