Java Messaging Service

Posted By : Navin Purohit | 28-May-2018

What Does JMS Do

Java messaging service which is also known as JMS is a method of communication between software components or applications. E-mails are also a way to communicate specifically from person to person or person to group or vice-versa. Using JMS we can talk from computer to computer.

JMS is an API provided by Sun microsystem that allows applications to:
1.create
2.send
3.receive
4.read messages

 

Programming Model

Architecture

Interaction

The administrator binds into a JNDI namespace using connection factories (CF) and destinations (D).
A JMS client using the JMS provider, lookup the administered objects and establish a logical connection.

 

Messages

JMS message consists of:-
1.Header
destination, timestamp

2.Properties (optional)
2.1 Message properties allow message receivers to choose which types of messages they would like to receive.
2.2 Message receivers use message selectors to filter out messages which are done at server side

3.Body (optional)
information part of the message

 

Message Consumption

JMS messages consumed in two ways:
1.Synchronously
A subscriber or receiver explicitly fetches a message from the destination using the “receive” method.
The “receive” method can block till a message arrives or reach to timeout incase message does not arrive on time limit

2.Asynchronously
A client can register a message listener (like an event listener) with a consumer.
Whenever  a message arrives at the destination the JMS Provider delivers the message by calling the listener’s “onMessage” method which acts on the contents of the message


 

Point-to-Point Messaging Domain

1. Applications are built around the concepts of message queues, senders, and receivers.
2. Queues retain all messages until they are either consumed or expired.
3. Each message has only one consumer.
4. There are no timing dependencies
5. The receiver acknowledges the successful processing of a message

Publish/Subscribe Messaging Domain

Use publish/subscribe messaging when each message can be processed by zero, one or many consumers and durable subscriptions exist for subscribers not currently active. Please refer below diagram. 


Message Oriented Middleware
1. HornetQ
2. ActiveMQ
3. RabbitMQ
4. JBossMQ
5. 
WebSphereMQ

About Author

Author Image
Navin Purohit

Navin has an experience of 4 years in Java and NodeJS. He is eager to learn new technologies and want to explore his inner strengths.

Request for Proposal

Name is required

Comment is required

Sending message..