Skip to main content
Version: Next

RabbitMQ Connector

The RabbitMQ Connector is an outbound Connector that allows you to connect your BPMN process with RabbitMQ to send messages to RabbitMQ.

Prerequisites

To use the RabbitMQ Connector, you need to have installed a RabbitMQ server and create the relevant credentials. Use Camunda secrets to store credentials, so that you don't expose sensitive information directly from the process. See this appendix entry to learn more.

note

Ensure you enter the correct exchange name and routing key, as the RabbitMQ Connector can't throw an exception if they are incorrect.

Create a RabbitMQ Connector task

You can apply a Connector to a task or event via the append menu. For example:

  • From the canvas: Select an element and click the Change element icon to change an existing element, or use the append feature to add a new element to the diagram.
  • From the properties panel: Navigate to the Template section and click Select.
  • From the side palette: Click the Create element icon.

change element

After you have applied a Connector to your element, follow the configuration steps or see using Connectors to learn more.

Connecting to RabbitMQ and sending messages

To connect to RabbitMQ, choose the required connection type in the Authentication section and complete the mandatory fields highlighted in red in the Connector properties panel:

note

All the mandatory and non-mandatory fields depending on the authentication selection you choose are covered in the upcoming sections.

Authentication

You can choose among the available RabbitMQ Connectors according to your authentication requirements. First, you must have a user in your RabbitMQ instance with the necessary permissions. See more at the RabbitMQ access control specification.

Next, we will choose the type of connection.

URI type connection

For a URI connection, take the following steps:

  1. Click the URI connection type in the Authentication section
  2. Set URI to URI. It must contain RabbitMQ username, password, host name, port number, and virtual host. For example, amqp://userName:password@serverHost:port/virtualHost; follow the RabbitMQ URI specification to learn more.

Credentials type connection

To connect with credentials, take the following steps:

  1. Click the Username/Password connection type in the Authentication section
  2. Set the Password to Password.

Routing data

In the Routing section, you must set the routing data attributes:

  • For a URI type connection, the required fields are exchange and routingKey.
  • For a Credentials type connection, the required fields are exchange, routingKey, virtualHost, hostName, and port.

Refer to the RabbitMQ documentation to learn about routing attributes:

Message

  1. In the Message section, insert the message payload. The message can be Text or JSON format.
  2. (Optional) In the Properties section, insert the message properties in JSON or as a FEEL expression. Go to RabbitMQ documentation for learn more about RabbitMQ message properties. example of message :
= {"myMessageKey":"Hello Camunda Team"}

example of properties:

= {
"contentEncoding":"UTF-8",
"contentType":"text/plain"
}

RabbitMQ Connector response

The RabbitMQ Connector returns the Success result. The response contains a messageId variable.

You can use an output mapping to map the response:

  1. Use Result Variable to store the response in a process variable. For example, myResultVariable.
  2. Use Result Expression to map specific fields from the response into process variables using FEEL. For example:
= {
"myResultVariable": response.statusResult
}

Appendix & FAQ

How do I store secrets for my Connector?

Use Camunda secrets to avoid exposing your credentials. Follow our documentation on managing secrets to learn more.