Skip to content

RabbitMQ

RabbitMQ is a robust messaging broker that operates using the Advanced Message Queueing Protocol (AMQP). While it's not a Java Message Service (JMS) provider, it supports the JMS API through its JMS topic exchange plugin and JMS client libraries. Martini Server Runtime will need these components to connect to a RabbitMQ broker.

Prerequisites

Before connecting to a RabbitMQ broker, ensure the following components are added:

After downloading the required libraries, place them in <martini-home>/lib/ext/.

Configuration

  1. Modify the Configuration File: Locate <martini-home>/conf/broker/rabbitmq.xml and change the uri property value to amqp://{username}:{password}@{broker-ip-address}:{port}.

  2. Use the Configuration File: Open <martini-home>/data/override.properties and add or change the following property:

    1
    jms.configuration-file=rabbitmq
    

  3. Restart Martini: Restart your Martini instance for the configuration changes to take effect. Verify the connection status under the Connections tab using the RabbitMQ management plugin.

It is recommended to review RabbitMQ documentation regarding with compatibility of JMS client before attempting to do any integrations.

Martini runtime supports publishing and receiving JMS message however publishing and receiving AMQP formatted message requires special handling.

Defining AMQP Destinations

For Martini Server Runtime to interact with AMQP queues, destination strings must include specific parameters:

Parameter Default Value Description
amqp false Set to true to indicate an AMQP destination.
exchangeName Default RabbitMQ Exchange Name of the exchange where messages will be sent. Required for sending AMQP messages, optional for receiving.
routingKey Queue/Topic Destination Name of the exchange where messages will be sent. Required for sending AMQP messages, optional for receiving.

An example destination string for AMQP: queue://com.torocloud.Hello?amqp=true&exchangeName=NotADefaultExchange&routingKey=johndoe

Sending & Receiving Messages

AMQP Messages

Sending

To send messages to an AMQP queue, set the amqp parameter to true in the destination string.

Receiving

Configure JMS listener endpoints to listen to destinations with amqp parameter set to true.

JMS Messages

Queue

Sending

Ensure pre-existing destination queues are configured with classic queue type, Durable durability, and true auto-delete.

Receiving

Receiving JMS messages will work out of the box.

Topic

Sending

No special configuration required.

Receiving

Receiving JMS messages from topics will work out of the box.

Tuning RabbitMQ

Before production deployment, note that RabbitMQ's JMS client does not fully implement the JMS API. Consider using ActiveMQ (Classic) or ActiveMQ Artemis for full JMS API compliance.

Network

Configure network settings for high client throughput.

Message Format

Optimize message size to decrease latency and increase throughput.

High Performance Erlang (HiPE)

Consider using HiPE for increased throughput.

Plugins

Review and disable unnecessary plugins to conserve resources.

Monitoring

Enable monitoring for issue detection and resolution.

Refer to RabbitMQ's production checklist for comprehensive guidance.