JMS messaging pattern is widely used for asynchronous communication. JMS is introduced between the Source and Target systems and the communication happen through messaging only. Systems are loosely coupled and they really don’t aware of each other. Source system can send the message to JMS without having knowledge of Target system.
Advantage of having JMS pattern
- Loosely coupled
- Asynchronous – Receiver will get the message as soon as it arrives on the JMS. Receiver don’t have to check the JMS on regular intervals.
- Reliable – JMS ensure/guarantee the delivery of messages and that to only once.
JMS pattern again can have two categories
- Queue (Point To Point pattern)
- Topic (Publisher Subscriber pattern)
Point to Point JMS pattern
Point to Point JMS pattern uses JMS Queue for communication. Here we can have one or multiple senders and only one receiver.
Point to remember
- P2P JMS use Queue for communication
- JMS sender/senders can send the message to queue without having knowledge of receiver
- JMS receiver will receive the message as and when it arrive on JMS queue
- There is no time dependency for the message to be consumed and can reside on the queue for long as per the Queue configuration
- JMS queue will store the message till the time it’s not consumed by the receiver. In case the JMS application restart then also message will not lost
Publisher Subscriber JMS pattern
Publisher Subscriber JMS pattern use JMS Topic for communication. Here we can have multiple publishers and subscribers. Copy of message is send to all the subscribers.
Point to remember
- Pub/Sub use JMS topic instead of queue
- Publishers can send the message to Topic and copy of message will be received by all the subscriber
- There is a time associated with the message where all subscriber should get the message before the time expired otherwise the message is not sent to the subscriber after time delay
- Topic doesn’t store the message for long
More information – https://docs.mulesoft.com/jms-connector/1.7/jms-topic-subscription
Note: Also read about C Program – Structure & Keywords in C.
Follow Me
If you like my post please follow me to read my latest post on programming and technology.
https://www.instagram.com/coderz.py/
https://www.facebook.com/coderz.py
![](http://coderzpy.com/wp-content/uploads/2022/02/20220121_231213-scaled-e1643999591962.jpg)