ApsaraMQ for RabbitMQ provides a Java Message Service (JMS) client library for JMS clients to connect to ApsaraMQ for RabbitMQ. This topic introduces the concepts related to the JMS client library provided by ApsaraMQ for RabbitMQ. This topic also describes the limits of the JMS client library and shows how to obtain and use the library.
Background information
JMS is a messaging standard that allows application components based on Java Platform, Enterprise Edition (Java EE) to create, send, receive, and read messages. JMS enables communication between distributed applications in a loosely coupled, reliable, and asynchronous manner. The JMS client library provided by ApsaraMQ for RabbitMQ supports JMS 1.1.
JMS library of ApsaraMQ for RabbitMQ
The JMS client library of ApsaraMQ for RabbitMQ is the JMS API provided by ApsaraMQ for RabbitMQ. To connect JMS applications to ApsaraMQ for RabbitMQ by using the JMS API, you need only to modify a small amount of code. Then, JMS applications can use ApsaraMQ for RabbitMQ as a JMS provider. You can use the JMS client library of ApsaraMQ for RabbitMQ to create JMS connections, sessions, producers, and consumers.
For information about differences between JMS and AMQP, see JMS and AMQP.
Obtain the JMS client library
Add the following dependency to the pom.xml file in your 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>
Limits
Server sessions are not supported.
The interfaces for eXtended Architecture (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 protocol provided by JMS clients for ApsaraMQ 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 may call a method that contains the NoLocal argument. However, the call is ignored.
For information about the implementation of the JMS API provided by ApsaraMQ for RabbitMQ, see Compatibility.
Tutorial
Messaging pattern | Description | References |
P2P | The JMS point-to-point (P2P) messaging pattern has the following characteristics:
| |
Pub/Sub | The publish-subscribe (Pub/Sub) messaging pattern has the following characteristics:
|