Available since version 5.5
RabbitMQ triggers enable triggering Processes on messages received from RabbitMQ queue. The RabbitMQ trigger consumes the message from the queue whenever there is a new message available. The contents of the consumed message are then available in the Process for further processing.
Configuring RabbitMQ Triggers
Name of the queue to listen to
AMQP 0-9-1 URI, e.g.
Max concurrent messages
Limit on how many messages will be processed at a time. Essentially will limit the number of Processes running at the same time on a single Agent. An empty value, or a value of 0 is treated as infinite.
Retry message processing if exception is thrown
If set, and the first Process execution fails in an exception, the Process is executed a second time
If set, the result of a successful Process execution will be sent to a response queue. The response queue is set to the
ReplyToproperty of the request. If the
ReplyToproperty is not set, the response queue is set to
Default reply queue
If set, the result of a failed Process execution will be sent to a response queue
Default reply queue
The queue to which responses will be sent if the
ReplyToproperty is not set
Trigger data for the Process
The trigger will pass the message content serialized as a UTF-8 string to the Process. It can be accessed via the
Message properties can be accessed under
#trigger.data.BasicProperties.CorrelationId. Some routing details are also available, e.g.
#trigger.data.RoutingKey. More information on properties and routing details is available in RabbitMQ's Publisher documentation.
Sometimes you need to get a reply back to the sender of the request, e.g. when the caller needs to wait for the triggered Process to finish, or needs the results. In this case, you can turn on replies on the RabbitMQ trigger. This will then return the result of the Process in a message that is put to the given reply queue.
The request-reply process usually goes as follows:
The caller decides on a queue for receiving the reply, and start listening to it. A message is sent to the queue listened by the trigger, with the
ReplyToproperty set to the reply queue. The
correlationIdproperty may also be set to help correlate requests and responses.
The trigger will receive the request and start a new Process instance, passing the message body and properties as trigger properties to the Process.
The Process finishes. In two cases, the flow ends here:
If the Process succeeded, and
Replyis not selected.
If the Process failed, and
Reply Errorsis not selected.
Otherwise, a response is created, which can happen in one of three ways:
If the Process succeeded, and the Process result is a RabbitMQ message (i.e, an object containing a
BasicProperties), the message is used as a response. This allows developers to customize the response to their exact needs.
If the Process succeeded, and the Process result is not a RabbitMQ message, the response is set to the Process result.
If the Process failed, the response is set to the message of the exception.
In the last two cases, the properties are set by the Agent. The
CorrelationIdproperty is set to the
CorrelationIdvalue from the request, and some other common properties set to sensible values.
The response is then sent to the queue given in the
ReplyToproperty, or if the request did not define one, in the
Default reply queue.
The caller will receive the reply message and process it as desired.