JMS Messaging Pattern

 

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.JMS Messaging Pattern

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

  • Point To Point pattern
  • Publisher Subscriber 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

One Sender and One Receiver

 

Multiple Senders and One Receiver

 

In Point to Point we can have JMS request and reply pattern as well

Here for both request and reply an individual queues are created where sender sends the request to request queue and receiver send a reply to reply queue which is consumed by sender. Here the reply queue is created temporarily and will be removed once the reply is received by the sender. Also while sending the request to request queue we have to set JMSReplyTo header to tell the receiver where exactly you are expecting a reply.

More info – https://docs.mulesoft.com/jms-connector/1.7/jms-publish-consume

 

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.

JMS Messaging Pattern

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

 

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments