The RabbitMQConnector extension provided by FNZ Studio offers tools to integrate with RabbitMQ.
The RabbitMQConnector extension allows configuring multiple RabbitMQ brokers.
The following configuration properties can be used to configure a broker called my-dev-broker:
rabbitmq.my-dev-broker.username — Username for the brokerrabbitmq.my-dev-broker.password — Password for the brokerrabbitmq.my-dev-broker.host — Host for the brokerrabbitmq.my-dev-broker.port — Port for the brokerrabbitmq.my-dev-broker.virtualHost — Virtual host for the brokerrabbitmq.my-dev-broker.useSSL — If true, SSL is used for the broker connection
To configure another broker, you can use a similar syntax and change the broker name, e.g., rabbitmq.another-broker.username = my-other-username
Every broker will use a connection and a channel pool. The channel pool can be configured through the following extension properties (System Configuration > Extensions > [RabbitMQConnector Extension] > Edit Configuration):
rabbitmq.my-dev-broker.channelpool.maxActive — Maximum number of active channels. Default is 2047 (same as default channel_max RabbitMQ configuration).rabbitmq.my-dev-broker.channelpool.maxIdle — Maximum number of idle channels. If this number is reached, the extra channels in idle state are closed. Default is 2047.rabbitmq.my-dev-broker.channelpool.maxWait — Maximum time (ms) to wait for getting a channel when the pool is exhausted. Default is 10000.rabbitmq.my-dev-broker.channelpool.timeBetweenEvictionRuns — Time (ms) between the runs of the thread which check and evict idle channels. Default is 120000 (2 minutes).rabbitmq.my-dev-broker.channelpool.minEvictableIdleTime — Minimum time (ms) during which a channel can be idle before it is evicted. Default is 300000 (5 minutes).
The RabbitMQConnector extension provides two components that can be used in Integration Links:
- A
Start Element called RabbitMQ Listener. This component can be used to receive messages from RabbitMQ. When FNZ Studio is running on multiple cluster nodes, only a cluster node will process a message received from RabbitMQ. The RabbitMQ Listener component has the following mandatory properties:
- Broker — Name of the RabbitMQ broker configured in the extension.
- Queue — Name of the queue to/from which messages should be sent/received. This must be previously created in RabbitMQ.
Note: The Integration Links that use the RabbitMQ Listener component must be restarted manually if the connection to RabbitMQ is interrupted (e.g., queue is recreated, RabbitMQ is restarted,and so on).
- An
End Component called RabbitMQ Sender. This component can be used to send messages to RabbitMQ. The RabbitMQ Sender component has the following properties:
- Broker — (mandatory) Name of the RabbitMQ broker configured in the extension.
- Exchange — (mandatory) Name of the RabbitMQ exchange to which messages should be sent. This must be previously created in RabbitMQ.
- Routing key — Routing key to send to the RabbitMQ exchange. It is:
- mandatory for direct and topic exchange
- optional for fanout exchange
The RabbitMQConnector extension provides a Script Function called RabbitMQConnector:SendMessage to send messages to a RabbitMQ exchange directly without involving Integration Links. The function has the following parameters:
Broker — (mandatory) Name of the RabbitMQ broker configured in the extension.Exchange — (mandatory) Name of the RabbitMQ exchange to which messages should be sent. This must be previously created in RabbitMQ.Message — (mandatory) Message to send to the exchange.Routing key — (optional) Routing key to send to the RabbitMQ exchange. It is:
- mandatory for direct and topic exchange
- optional for fanout exchange
Following is additional information to be considered:
- The messages sent/received to/from RabbitMQ are encoded using UTF-8 charset.
- RabbitMQ connections can recover automatically. During the recovery process, error messages are logged describing the connection problem. To avoid log pollution, the corresponding log level can be increased during
troubleshooting (e.g., you can set the com.rabbitmq.client.impl.ForgivingExceptionHandler log level to FATAL). - If the RabbitMQConnector extension needs to be restarted at runtime, the Integration Links that use the RabbitMQ Sender or RabbitMQ Listener components must be stopped manually before the extension is stopped and then started again.