Configuration
This page describes the configuration that administrators prepare so that scripts can send messages to RabbitMQ queues using the function api.queue.v1.publishAsync (page Lowcode to RabbitMQ).
To configure it, you need the data that the process designer agreed with the administrators and sent in the ticket (example ticket): the connection name, the exchange or target queue, the routing key, and information about which scripts will send messages.
Configuration example
Set the variables in the env.yaml (ConfigMap) of each application in the section Applications that require configuration. Full example of connection configuration INTEGRATION:
# RabbitMQ broker data, common to all connections
SCRIPT_QUEUE_COMMON_PRODUCER_CLIENT_HOST: 'rabbitmq.bank.local'
SCRIPT_QUEUE_COMMON_PRODUCER_CLIENT_PORT: '5671'
SCRIPT_QUEUE_COMMON_PRODUCER_CLIENT_SSL_ENABLED: 'true'
SCRIPT_QUEUE_COMMON_PRODUCER_CLIENT_SSL_VALIDATE_SERVER_CERTIFICATE: 'true'
SCRIPT_QUEUE_COMMON_PRODUCER_CLIENT_SSL_VERIFY_HOSTNAME: 'true'
SCRIPT_QUEUE_COMMON_PRODUCER_CLIENT_VIRTUAL_HOST: 'eximee'
SCRIPT_QUEUE_COMMON_PRODUCER_CLIENT_USERNAME: '<username>'
SCRIPT_QUEUE_COMMON_PRODUCER_CLIENT_PASSWORD: '<password>'
# Connection "integration": default exchange, routing key = queue name
SCRIPT_QUEUE_INTEGRATION_PRODUCER_EXCHANGE: ''The following sections describe where to get the values for this example, which applications to set them in, how to prepare the broker, and then the connections, segment COMMON and each variable.
Data from the ticket
Connection name, for example integration
The process designer may suggest a name. Confirm it or indicate an existing connection. Use it in uppercase in variable names, for example SCRIPT_QUEUE_INTEGRATION_PRODUCER_EXCHANGE. The name cannot contain the character _ (section Connection name).
Exchange
Enter it in SCRIPT_QUEUE_<CONNECTION>_PRODUCER_EXCHANGE. For the default exchange, set an empty value ''.
Target queue and routing key
Create the queue on the broker, and for a named exchange also create a binding from the exchange with this routing key. In Eximee configuration you do not enter them: the routing key is provided by the script with each send.
Sending from a service script in a form
Configure the connection in the application webforms (section Applications that require configuration).
Sending from a script task in a process
Configure the connection in the application process-handler-executor-camunda.
Applications that require configuration
The message is sent by the application that executes the script. Add the connection configuration in each application from which scripts are to send messages:
webforms
Service scripts invoked from forms.
process-handler-executor-camunda
Script tasks in processes.
The configuration of one application does not work in another. If the connection integration is configured only in webforms, the script task that uses it will fail with an error No queue client found. [connectionId=integration].
Preparing the broker
The platform does not create queues, exchanges, or bindings on the broker. They are prepared by the RabbitMQ administrator.
Connections and segment COMMON
The configuration consists of named connections. A connection is broker data (address, virtual host, user, TLS) and the exchange to which sent messages go. The script uses the connection name to indicate where to send the message.
COMMON is not a connection. It is a set of default values that the application adds to every connection. A connection can override any of them with its own value.
A connection is created only when it has an exchange set (PRODUCER_EXCHANGE). A connection without an exchange is not created, and the script that uses it ends with an error No queue client found.
Typical configuration: one broker
In most deployments, all queues are on one broker, in one virtual host. Then:
set the broker data once, in the variables
SCRIPT_QUEUE_COMMON_PRODUCER_CLIENT_*,create one connection, for example
INTEGRATION, and set only the exchange in it.
Such a configuration is shown by the configuration example at the top of the page.
Several connections: different broker, virtual host, user, or exchange
Add another connection when some messages need to go to a different broker, a different virtual host, with a different user, or to a different exchange. In the new connection, set its exchange and the data that differ from COMMON.
Example: connection PARTNER sends to the exchange partner.events in the virtual host partner. The address, port, TLS, and login data are taken from COMMON:
In the script, refer to it by the name 'partner'.
Connection name
The connection name is the part of the variable name between SCRIPT_QUEUE_ and _PRODUCER. In the example SCRIPT_QUEUE_INTEGRATION_PRODUCER_EXCHANGE the connection is called INTEGRATION.
In the script, use the connection name in lowercase:
'integration'. A name written in uppercase ends with an errorNo queue client found.The connection name is one word, without the character
_. The application treats the character_in the variable name as a separator. From the variableSCRIPT_QUEUE_BANK_CENTRALNY_PRODUCER_EXCHANGEno connection will be createdBANK_CENTRALNY, and the script that calls'bank_centralny', will end with an errorNo queue client found. Use for exampleBANKCENTRALNYand in the script'bankcentralny'.Name
COMMONis reserved for default values and does not create a connection.
Variables
Connection to the broker
Instead of <CONNECTION> enter COMMON (value for all connections) or the connection name (value only for that one). The default value applies when the variable is not set either for the connection or in COMMON.
SCRIPT_QUEUE_<CONNECTION>_PRODUCER_CLIENT_HOST
Broker address.
localhost
SCRIPT_QUEUE_<CONNECTION>_PRODUCER_CLIENT_PORT
Broker port.
5671 when TLS is enabled, otherwise 5672
SCRIPT_QUEUE_<CONNECTION>_PRODUCER_CLIENT_VIRTUAL_HOST
RabbitMQ virtual host.
/
SCRIPT_QUEUE_<CONNECTION>_PRODUCER_CLIENT_USERNAME
Broker user.
guest
SCRIPT_QUEUE_<CONNECTION>_PRODUCER_CLIENT_PASSWORD
Broker user password.
guest
SCRIPT_QUEUE_<CONNECTION>_PRODUCER_CLIENT_SSL_ENABLED
true enables connection encryption (TLS).
false
SCRIPT_QUEUE_<CONNECTION>_PRODUCER_CLIENT_SSL_VALIDATE_SERVER_CERTIFICATE
true enables broker certificate verification. Description in the section Encrypted connection (TLS).
false
SCRIPT_QUEUE_<CONNECTION>_PRODUCER_CLIENT_SSL_VERIFY_HOSTNAME
true enables checking whether the broker certificate was issued for its address.
false
Connection exchange
Instead of <CONNECTION> enter the connection name. Do not set this variable in COMMON.
SCRIPT_QUEUE_<CONNECTION>_PRODUCER_EXCHANGE
Exchange to which the connection sends messages. Empty value '' means the default exchange: the message goes to the queue whose name is equal to the routing key.
None: a connection without an exchange is not created
Encrypted connection (TLS)
For an encrypted connection with broker certificate verification, set all three variables:
The broker certificate is then checked using the default Java truststore in the application image. A self-signed certificate or one issued by an internal CA will be rejected if that CA is not in the truststore.
Deploying configuration changes
The application creates connections at startup. After changing env.yaml, for example after adding a connection, restart the application.
The application does not connect to the broker at startup, only on the first send. So it will also start when the broker is unavailable or the connection data is wrong, and the error will appear only in the script that sends the message.
Checking operation
Run the script that sends a message, for example the sample service script from the page Lowcode to RabbitMQ.
If the script ended with an error, compare the message with the table in the section Troubleshooting.
In the RabbitMQ Management panel, open the target queue, expand the Get messages section, and fetch the message. Check its content and headers.
The application does not write information about sent messages to the logs at the INFO level. Sending entries are added by the script itself through the Loggerobject, as in the sample service script.
Troubleshooting
The script ends with an error No queue client found. [connectionId=<name>]
The connection is not configured in the application that executes the script, there is no PRODUCER_EXCHANGE set, or its name contains the character _.
Add a connection from PRODUCER_EXCHANGE in this application and restart it.
The script ends with an error AmqpConnectException, AmqpAuthenticationException or AmqpIOException
The application connects to the broker on the first send. AmqpConnectException: the broker is unavailable or the address or port is incorrect. AmqpAuthenticationException: invalid login credentials. AmqpIOException: for example, the virtual host does not exist.
Check the PRODUCER_CLIENT_* variables and the broker's availability from the application. For port 5671 check whether SSL_ENABLED.
The script ends without an error, and there is no message in the queue
The exchange from PRODUCER_EXCHANGE does not exist on the broker, the exchange binding with the queue is missing, or the routing key does not match any queue.
Check the exchange, bindings, and routing key on the broker.
Related pages
Lowcode to RabbitMQ — sending messages from scripts and script tasks.
RabbitMQ consumer configuration — receiving message configuration.
Last updated
Was this helpful?
