For the complete documentation index, see llms.txt. This page is also available as Markdown.

Low-code for RabbitMQ

The availability of this functionality depends on the license and may not be available in all deployments.

Purpose

Enable sending messages to a specified RabbitMQ queue directly from requests (scripts) and BPMN processes (script tasks).

Usage examples

  • Sending a request to an external system, with the response returned asynchronously (see RabbitMQ consumers)

  • Notifying external systems about process status changes

  • Communication with external systems (e.g. bank systems)

How it works

1. The script calls api.queue.v1.publishAsync with the connection name, routing key,
                           message body and headers
2. The Eximee application converts the body to JSON and publishes the message to the exchange
                           configured for this connection, with the given routing key
3. The RabbitMQ broker routes the message to queues that have an exchange binding with this routing key

The broker connection and exchange are configured by the administrator in the application settings. The script only specifies the connection name and routing key.

Step 1. Determine the details with the administrators

Before writing the script, determine with the administrators:

  • the connection name, through which the script sends messages, for example integration. The process designer can suggest a name, and the administrators confirm it or indicate an existing connection. The name is one word, without the character _,

  • where the message should go, i.e. the exchange and routing key. These two values are determined together, because the exchange determines what the routing key is:

    • for the default exchange (an empty exchange name in the configuration), the routing key is the name of the target queue, so it is enough to determine the queue,

    • for a custom exchange, determine its name and routing key. Which queue the message will go to is decided by the bindings defined on the broker,

  • where you send messages from: from a service script in a form, from a script task in a process, or from both. This determines in which applications the administrators configure the connection.

In the examples on this page, messages are sent through the connection integration with the default exchange to the queue eximee_demo_integration. Messages are consumed from this queue by the consumer described on the page RabbitMQ consumers.

Request example

Send the agreed details to the administrators in the request, for example:

The configuration that the administrators prepare on this basis is described on the page RabbitMQ sending configuration.

Step 2. Send a message from the script

Parameter
Description
Where to get the value from

connection name

The connection name from the application configuration, written in lowercase. Case matters: 'INTEGRATION' instead of 'integration' results in an error.

Name agreed with the administrators in step 1.

routing key

The message routing key. For the default exchange, it is the name of the target queue.

Routing key agreed with the administrators in step 1.

body

The value that the function converts to JSON (JSON.stringify). Description in the section Message body and headers.

You determine it with the message recipient.

headers

Object with message headers. The parameter is required: if you are not sending headers, provide {}.

You determine it with the message recipient.

The function returns after passing the message to the broker. It does not wait for confirmation that the broker accepted the message or that the recipient processed it.

Sample service script

The service script reads the parameters processInstanceId and data, builds the message and sends it to the queue eximee_demo_integration:

For the parameters processInstanceId = 8f0b7a52-0c43-11ef-9a1c-0242ac120002 and data = sample value to the queue eximee_demo_integration the message goes:

Sample script task

The script task sends a message with the process instance ID. If sending fails, it raises an incident on the task, so the process stops until intervention:

More about script tasks: Script Tasks API.

Message body and headers

The function always converts the body to JSON using JSON.stringify. The message is sent with content type application/json, encoding UTF-8 and as persistent.

Passed body
Message body on the queue

{processInstanceId: '123', data: 'x'}

{"processInstanceId":"123","data":"x"}

{d: new Date(0)}

{"d":"1970-01-01T00:00:00.000Z"}: data as text in the UTC time zone

'abc'

"abc": text in quotes

JSON.stringify({a: 1})

"{\"a\":1}": JSON encoded a second time

null

null

undefined

undefined: a body that is not valid JSON

Headers:

  • Header values must be text. A number or boolean value will cause an error; convert it using the function String().

  • Header with a value null is omitted.

  • The message has no identifier set (message_id) or timestamp (timestamp). If the recipient needs them, pass them in the body or headers.

Error handling

The function raises an error that you can catch in a try/catchblock, when:

Situation
Error message

No connection with the specified name is configured in the application, or the name has different letter casing

No queue client found. [connectionId=<name>]

The broker is unavailable

org.springframework.amqp.AmqpConnectException: ...

The header value is not text

ClassCastException

Missing headers parameter

Can't find method ... publishAsync(...)

Troubleshooting

Symptom
Possible cause
Solution

Error No queue client found. [connectionId=...]

The connection name in the script differs from the configuration, is written in uppercase, or the connection is not configured in the application that runs the script.

Use the lowercase name. Ask the administrators to check the configuration (page RabbitMQ sending configuration).

The script finishes without an error, but the message is not on the queue

Incorrect routing key, no binding with the queue, or an exchange that does not exist on the broker.

Check the routing key and bindings on the broker with the administrators.

The recipient gets text in quotes instead of a JSON object

The body was converted to text before calling the function.

Pass the body as an object.

Error ClassCastException

The header value is not text.

Convert the value using the function String().

Last updated

Was this helpful?