RabbitMQ parameters¶
When you implement an integration use case that requires a RabbitMQ connection, you can use the following RabbitMQ parameters in your proxy service artifact.
Info
The Micro Integrator can listen to a RabbitMQ instance or send messages to a RabbitMQ instance only if the RabbitMQ transport listener and sender are enabled and configured at the server level. Read about the RabbitMQ transport.
Service-Level parameters (receiving messages)¶
To add service-level transport parameters to a proxy service:
- Open your proxy service artifact in MI VS Code extension.
-
In the Design View, click on the Edit button and expand the Advanced Options section and navigate to Service Parameters.
-
Click the
Add Parameter
text button to open the following form to add the parameter name and value as a key-value pair:
See Creating a Proxy Service for instructions.
Required parameters¶
Parameter | Description |
---|---|
rabbitmq.connection.factory | The name of the connection factory. |
rabbitmq.exchange.name |
Name of the RabbitMQ exchange to which the queue is bound. Use this parameter instead of rabbitmq.queue.routing.key if you need to use the default exchange and publish to a queue.
|
rabbitmq.queue.name | The queue name to send or consume messages. If you do not specify this parameter, you need to specify the rabbitmq.queue.routing.key parameter. |
Other parameters (optional)¶
Parameter | Description |
---|---|
rabbitmq.queue.auto.ack |
Defines how the message processor sends the acknowledgement when consuming messages recived from the RabbitMQ message store. If you set this to true, the message processor automatically sends the acknowledgement to the messages store as soon as it receives messages from it. This is called an auto acknowledgement.
If you set it to false , the message processor waits until it receives the response from the backend to send the acknowledgement to the mssage store. This is called a client acknowledgement.
However, you can increase the performance of message processors either by increasing the member count or by having multiple message processors. If you increase the member count, it will create multiple child processors of the message processor.
|
rabbitmq.consumer.tag | The client generated consumer tag to establish context. |
rabbitmq.channel.consumer.qos |
The consumer's QoS value. You need to specify this parameter only if the rabbitmq.queue.auto.ack parameter is set to false .
|
rabbitmq.queue.durable | Whether the queue should remain declared even if the broker restarts. |
rabbitmq.queue.exclusive | Whether the queue should be exclusive or should be consumable by other connections. |
rabbitmq.queue.auto.delete | Whether to keep the queue even if it is not being consumed anymore. |
rabbitmq.queue.routing.key | The routing key of the queue. |
rabbitmq.queue.autodeclare |
Whether or not to declare the queue. If set to true , the Micro Integrator creates queues if they are not already
present. If set to false , the Micro Integrator will assume that a queue is already available. However, you should set this parameter to true only if queues are not already declared in the RabbitMQ server. Setting this parameter to false in the publish URL improves RabbitMQ transport performance.
|
rabbitmq.exchange.autodeclare |
Whether or not to declare the exchange. If set to true , the Micro Integrator creates exchanges. If set to false , the Micro Integrator will assume that an exchange is already available. However, you should set this parameter to true only if exchanges are not already declared in the RabbitMQ server. Setting this parameter to false in the publish URL improves RabbitMQ transport performance.
|
rabbitmq.exchange.type | The type of the exchange. |
rabbitmq.exchange.durable> | Whether the exchange should remain declared even if the broker restarts. |
rabbitmq.exchange.auto.delete | Whether to keep the exchange even if it is not bound to any queue anymore. |
rabbitmq.message.content.type |
The content type of the consumer. Note: If the content type is specified in the message, this parameter does not override the specified content type. The default value is text/xml .
|
rabbitmq.connection.pool.size | You can increase the connection pool size to improve the performance of the RabbitMQ sender and listener. The default connection pool size is 20. |
Connection recovery parameters (optional)¶
In case of a network failure or broker shutdown, the Micro Integrator will try to recreate the connection.
Parameter | Description |
---|---|
rabbitmq.connection.retry.interval |
The retry interval specifies how frequently (time interval) the Micro Integrator should retry to recreate a lost connection. The default value is 30000 ms. That is, the Micro Integrator retries to connect every 30000 miliseconds.
|
rabbitmq.connection.retry.count |
The retry count specifies the number of times the Micro Integrator will try to recreate a lost connection. The default retry count is 3 . That is, the Micro Integrator retries only 3 times.
|
rabbitmq.server.retry.interval |
This parameter is optional.
The parameters specified above set the retry interval with which the RabbitMQ client tries to reconnect. Generally, having this value less than the value specified as rabbitmq.connection.retry.interval will help synchronize the reconnection of the Micro Integrator and the RabbitMQ client.
|
SSL parameters (optional)¶
To enable SSL support in RabbitMQ, you need to configure the following parameters.
Parameter | Description |
---|---|
rabbitmq.connection.ssl.enabled | Specifies whether SSL is enabled for the connection. |
rabbitmq.connection.ssl.version | When SSL is enabled, you can specify the SSL protocols that are supported. |
Tip
Note that keystore information is not required for an SSL connection if the fail_if_no_peer_cert
parameter is set to 'false' in the RabbitMQ broker. You only need to enable SSL in the Micro Integrator (using the rabbitmq.connection.ssl.enabled
parameter).
However, if the fail_if_no_peer_cert
parameter is set to 'true' in RabbitMQ, the keystore configurations (given below) are also required for the Micro Integrator.
Shown below is an example of the config file where fail_if_no_peer_cert
is set to false
:
ssl_options.cacertfile = /path/to/ca_certificate.pem
ssl_options.certfile = /path/to/server_certificate.pem
ssl_options.keyfile = /path/to/server_key.pem
ssl_options.verify = verify_peer
ssl_options.fail_if_no_peer_cert = false
Parameter | Description |
---|---|
rabbitmq.connection.ssl.keystore.location | The location of the keystore that is used. |
rabbitmq.connection.ssl.keystore.type | The type of keystore. |
rabbitmq.connection.ssl.keystore.password | The keystore password. |
rabbitmq.connection.ssl.truststore.location | The location of the truststore. |
rabbitmq.connection.ssl.truststore.type | The type of the truststore. |
rabbitmq.connection.ssl.truststore.password | The password of the keystore. |
Service-Level parameters (sending messages)¶
In your integration solution, the following RabbitMQ send parameters can be specified in the Address URL that you specify in your Endpoint artifact.
Example:
-
Design view of an address endpoint in WSO2 Integration Studio:
Double-click the Address Endpoint artifact to open the Properties tab and enter the address URL with RabbitMQ parameters.
-
Source view of an address endpoint:
<endpoint> <address uri="rabbitmq:/AMQPProducerSample?rabbitmq.server.host.name=localhost&rabbitmq.server.port=5672&rabbitmq.queue.name=queue&rabbitmq.queue.route.key=route&rabbitmq.exchange.name=exchange"> </address> </endpoint>
Required parameters¶
Parameter | Description |
---|---|
rabbitmq.server.host.name | Host name of the server. |
rabbitmq.server.port | Port number of the server. |
Optional parameters¶
Parameter | Description |
---|---|
rabbitmq.exchange.name |
The name of the RabbitMQ exchange to which the queue is bound. Use this parameter instead of rabbitmq.queue.routing.key , if you need to use the default exchange and publish to a queue.
|
rabbitmq.queue.routing.key | The exchange and queue binding key that will be used to route messages. |
rabbitmq.replyto.name | The name of the callback queue. Specify this parameter if you expect a response. |
rabbitmq.queue.delivery.mode |
The delivery mode of the queue. Possible values are 1 and 2. 1 - Non-persistent. 2 - Persistent. This is the default value. |
rabbitmq.exchange.type | The type of the exchange. |
rabbitmq.queue.name | The queue name to send or consume messages. If you do not specify this parameter, you need to specify the rabbitmq.queue.routing.key parameter. |
rabbitmq.queue.durable | Whether the queue should remain declared even if the broker restarts. The default value is false . |
rabbitmq.queue.exclusive | Whether the queue should be exclusive or should be consumable by other connections. The default value is false . |
rabbitmq.queue.auto.delete | Whether to keep the queue even if it is not being consumed anymore. The default value is false . |
rabbitmq.exchange.durable | Whether the exchange should remain declared even if the broker restarts. |
rabbitmq.queue.autodeclare |
Whether to create queues if they are not present. However, you should set this parameter only if queues are not declared prior on the broker. Setting this parameter in the publish URL to false improves RabbitMQ transport performance.
|
rabbitmq.exchange.autodeclare | Whether to create exchanges if they are not present. However, you should set this parameter only if exchanges are not declared prior on the broker. Setting this parameter in the publish URL to false improves RabbitMQ transport performance. |
rabbitmq.message.correlation.id | The correlation ID is required to identify a message that comes through one queue and requires a response back via another queue. This ID helps you map the messages and is unique for every request. |
rabbitmq.message.id | Every message has its own unique message ID. |
CachedRabbitMQConnectionFactory | This parameter increases the performance and provides higher throughput in message delivery. |
rabbitmq.connection.pool.size | You can increase the connection pool size to improve the performance of the RabbitMQ sender and listener. The default connection pool size is 20. |
Mediator properties¶
In addition to the parameters described above, you can define RabbitMQ properties using the Property mediator and the Property Group mediator.