Connecting to RabbitMQ¶
This section describes how to configure OxyNexus Micro Integrator to connect with RabbitMQ.
Tip
See the complete list of server-level configurations for the RabbitMQ Listener and RabbitMQ Sender in the deployment.toml
file (stored in the MI_HOME/conf
directory).
Setting up RabbitMQ¶
Please refer RabbitMQ Deployment
Enabling the RabbitMQ Listener¶
Uncomment the following parameters in the deployment.toml
file to configure the RabbitMQ listener.
[[transport.rabbitmq.listener]]
name = "AMQPConnectionFactory"
parameter.hostname = "localhost"
parameter.port = 5672
parameter.username = "guest"
parameter.password = "guest"
Enabling the RabbitMQ Sender¶
Uncomment the following parameters in the deployment.toml
file to enable the RabbitMQ sender.
[transport.rabbitmq]
sender_enable = true
Enabling SSL¶
Add the following parameters to enable SSL for the RabbitMQ listener.
[[transport.rabbitmq.listener]]
parameter.ssl_enable = true
parameter.ssl_version = "SSL"
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 parameter.ssl_enable
parameter shown above). You can check the fail_if_no_peer_cert
parameter in the rabbitmq.conf
file in its OS-specific location.
Shown below is an example of the configuration 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
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.
parameter.keystore_location ="repository/resources/security/wso2carbon.jks"
parameter.keystore_type = "JKS"
parameter.keystore_password = "wso2carbon"
parameter.truststore_location ="repository/resources/security/client-truststore.jks"
parameter.truststore_type = "JKS"
parameter.truststore_password = "wso2carbon"
Configuring connection recovery¶
Add the following parameters under the RabbitMQ to the deployment.toml file (stored in the MI_HOME/conf
directory).
[[transport.rabbitmq.listener]]
parameter.retry_interval = "10"
parameter.retry_count = 5
In case of a network failure or broker shutdown, OxyNexus Micro Integrator will try to recreate the connection. The following parameters need to be configured in the transport listener to enable connection recovery in RabbitMQ.
If the parameters specified above are set, the Micro Integrator will retry 5 times with 10000 ms time intervals to reconnect when the connection is lost. If reconnecting also fails, the Micro Integrator will terminate the connection. If you do not specify values for the above parameters, the Micro Integrator uses 30000ms as the default retry interval and 3 as the default retry count.
Optionally, you can configure the following parameter in your proxy service when you define your mediation sequence:
<parameter name="rabbitmq.server.retry.interval" locked="false">10000</parameter>
The parameter specified above sets 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.
Configuring high throughput of message delivery¶
For increased performance and higher throughput in message delivery, configure the transport sender as shown below.
Add the following parameters under the RabbitMQ to the deployment.toml file (stored in the MI_HOME/conf
directory).
[[transport.rabbitmq.sender]]
name = "CachedRabbitMQConnectionFactory"
parameter.hostname = "localhost"
parameter.port = 5672
parameter.username = "guest"
parameter.password = "guest"
rabbitmq.connection.factory=CachedRabbitMQConnectionFactory
.
Configure proxy-level throttling¶
To enable throttling for the RabbitMQ proxy service listener, you can add the following configuration to the proxy service:
<parameter name="rabbitmq.proxy.throttle.enabled">true</parameter>
<parameter name="rabbitmq.proxy.throttle.mode">fixed-interval</parameter>
<parameter name="rabbitmq.proxy.throttle.timeUnit">minute</parameter>
<parameter name="rabbitmq.proxy.throttle.count">60</parameter>
Note
Allowed parameters for rabbitmq.proxy.throttle.mode
: fixed-interval, batch
Allowed parameters for rabbitmq.proxy.throttle.timeUnit
: minute, hour, day
When enabling throttling for the RabbitMQ proxy service listener, to ensure that the message consumer retrieves only one message at a time from the RabbitMQ queue, you can add the following properties to the proxy service. This will avoid potential data loss if the server is restarted.
<parameter name="rabbitmq.channel.consumer.qos">1</parameter>
<parameter name="rabbitmq.queue.auto.ack">false</parameter>