Message Queue for RabbitMQ provides a Java Message Service (JMS) client library for JMS applications to connect to Message Queue for RabbitMQ. This article describes the common concepts and limits of the JMS client library that Message Queue for RabbitMQ provides. This article also introduces how to obtain and use the JMS client library.
JMS client library of Message Queue for RabbitMQ
The JMS client library of Message Queue for RabbitMQ is the JMS API provided by Message Queue for RabbitMQ. To connect JMS applications to Message Queue for RabbitMQ by using this library, you need to change only a small amount of code. Then, JMS applications can use Message Queue for RabbitMQ as a JMS provider. You can use the JMS client library of Message Queue for RabbitMQ to create JMS connections, sessions, producers, and consumers.
For more information about JMS and AMQP, see JMS and AMQP.
You can use one of the following methods to call the JMS client library of Message Queue for RabbitMQ:
- Add the following dependency to the pom.xml file in the Maven project:
<dependency> <groupId>com.alibaba.mq-amqp.jms</groupId> <artifactId>mq-amqp-jms-client</artifactId> <version>1.11.2-1.0.0</version> <exclusions> <exclusion> <groupId>com.rabbitmq</groupId> <artifactId>amqp-client</artifactId> </exclusion> </exclusions> </dependency>
- Download the JAR file of the dependency.
The JMS client library of Message Queue for RabbitMQ has the following limits:
- Server sessions are not supported.
- The interfaces for XA transactions are not implemented.
- Topic selectors are supported. Queue selectors are not implemented.
- Secure Sockets Layer (SSL) and socket options are provided. However, only the default SSL connection protocols provided by JMS clients for Message Queue for RabbitMQ can be used.
- The NoLocal subscription feature is not supported. This feature prevents a subscriber from publishing messages from its own connection. You can call a method that contains the NoLocal argument. However, but the call will be ignored.
For more information about the implementation of the JMS API for Message Queue for RabbitMQ, see Compatibility.
The following table describes how to use the JMS client library of Message Queue for RabbitMQ.
|P2P||The JMS point-to-point (P2P) messaging model has the following features:
|Pub/Sub||The Publish/Subscribe (Pub/Sub) messaging model has the following features: