JMS Connector - Mule 4
Anypoint Connector for JMS (Java Message Service) (JMS Connector) enables sending and receiving messages to queues and topics for any message service that implements the JMS specification. JMS is a widely used API for message-oriented middleware. It enables the communication between different components of a distributed application to be loosely coupled, reliable, and asynchronous. The main features of JMS Connector include:
-
Publish and subscribe pattern support on any given destination
-
Listen and reply pattern support on any given destination
-
Publish and consume pattern support on any given destination, with a fixed or temporary reply queue
-
Fully compliant with JMS 2.0, 1.1, and 1.0.2 specifications
Before You Begin
To use this connector, you must be familiar with:
-
Java Message Service
-
Anypoint Connectors
-
Mule runtime engine (Mule)
-
Elements and global elements in a Mule flow
-
Creating a Mule app using Anypoint Studio (Studio)
Before creating an app, you must have access to Anypoint Platform and Anypoint Studio.
Common Use Cases for the Connector
JMS Connector enables you to:
-
Listen for new messages as they arrive at a specified destination.
-
Publish a new message and send it to a specified destination.
-
Consume a message at any given time in the flow from any given specified destination.
-
Publish a message to any specified destination, and then consume a reply on a different specified destination.
For examples, see JMS Connector Examples.
JMS Messaging Support Models
JMS supports two models for messaging:
-
Point-to-point queues
-
Publish and subscribe topics
Point-to-Point Queues
In the point-to-point queuing model, a sender posts messages to a particular queue and a receiver reads those messages from that same queue. In this model, the sender knows the destination of the message and posts the message directly to it.
The point-to-point queuing model operates as follows:
-
Only one receiver consumes the received message.
-
The sender does not need to be running at the time the receiver consumes the message, and the receiver does not need to be running at the time the message is sent.
-
Every message that is successfully processed is acknowledged by the receiver.
Publish and Subscribe Topics
The publish and subscribe model supports a sender in publishing messages to a particular message topic rather than directly to a particular queue. Receivers subscribe to consume the receive messages on a particular message topic. In this model, neither the sender nor the receiver are aware of each other. An anonymous bulletin board is a good analogy for this concept.
The publish and subscribe model operates as follows:
-
Multiple receivers consume the receive the message, including none if there are no subscribers to the topic.
-
The sender must create a message topic in such a way that receivers can subscribe to that topic.
-
The receiver must remain continuously active to consume the receive messages, unless it has established a durable subscription in which case messages sent while the receiver is not connected are redistributed when the receiver reconnects.
Next Step
After you complete the prerequisites, you are ready to create your own app and configure the connector using Anypoint Studio.