Skip to content

Home

Development

IDEs

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

RabbitMQ as the instance message broker

RabbitMQ, like most messaging systems, provides a common platform for sending and receiving messages. It is a messaging broker that operates using Advanced Message Queueing Protocol (AMQP)1. Martini supports brokers that implement the Java Message Service (JMS)2 API. RabbitMQ is not a JMS provider but provides support for it using its JMS topic exchange plugin and JMS client libraries. Martini will need these components to connect to a RabbitMQ broker.

Limitations

As of this writing, RabbitMQ's JMS client does not fully implement the JMS API. Using unsupported methods may result in connection failures or undelivered messages. As a consequence of these limitations, Martini uses an in-memory broker for WebSocket messages. All WebSocket messages will not be routed to RabbitMQ.

Prerequisites

Before connecting to a RabbitMQ broker, the following components must be added:

  • RabbitMQ topic exchange plugin, which is a plugin included with RabbitMQ by default although it will need enabling by executing:

    1
    rabbitmq-plugins enable rabbitmq_jms_topic_exchange
    

    After executing the command, the plugin is activated automatically. A broker restart is not needed.

  • RabbitMQ JMS client library, which contains RabbitMQ's implementation of the JMS API. You can download the JAR file via Maven Central or Bintray.

  • RabbitMQ Java client library, which is a dependency of the JMS client library required for Java applications to interact with RabbitMQ. You can also download the JAR file via Maven Central or Bintray.

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

Configuration

  1. Modify the configuration file.

    The configuration for RabbitMQ JMS clients is located in <martini-home>/conf/broker/rabbitmq.xml. Open this file and change the uri property value to amqp://{username}:{password}@{broker-ip-address}:{port}. Variables enclosed in braces ({}) must be substituted accordingly.

  2. Use the configuration file.

    By default, Martini uses an embedded instance of ActiveMQ. To configure Martini to use the RabbitMQ configuration file instead, open the <martini-home>/data/override.properties file and then add the following property:

    1
    jms.file=rabbitmq
    
  3. Restart Martini.

    Before the configuration takes effect, you will need to restart your Martini instance.

    If everything is configured correctly, Martini should be able to start. If you have enabled the RabbitMQ management plugin, you can check the connection status under the Connections tab.

    RabbitMQ web interface, Connections tab


  1. Advanced Message Queueing Protocol (AMQP) is a standard for asynchronous messaging and is designed to support a large variety of messaging applications. 

  2. Java Message Service (JMS) is a set of interfaces that allows Java applications to communicate with other messaging implementations.