Java Messaging Service (JMS) API is a specification that allows java programs to create, send and receive messages asynchronously from one application to another. This communication is loosely coupled and very much reliable.
JMS Provider is a messaging system that implements the JMS specification. This acts as the Message Oriented Middleware (MOM) which helps in message communication between two systems connected over the network. The message communication, no doubt, is asynchronous and reliable.
Below are some of the popular MOM Service Providers –
- TIBCO EMS (TIBCO)
- ActiveMQ (Apache)
- JBOSSMQ (JBOSS)
- MQSeries (IBM)
Java applications that create and send the message are known as the JMS Producer / Publisher while the applications that receive the message are said to be JMS Consumer/ Subscriber.
There are two messaging models in JMS –
- Point to Point (PTP)
- Publisher/ Subscriber (Pub/Sub)
Point to Point (PTP)
This model consists of the message queues, senders, and the receivers. Each message is sent or dispatched to a particular queue by the sender, which is received by the configured listeners on the other side. Queues hold the messages until they are processed or consumed, or until the messages on the queue timeout.
Publisher/ Subscriber (Pub/Sub)
In this model, clients drop messages to a topic. This topic holds and delivers the message to all the topic subscribers. However, the publisher and subscriber have a timing dependency, such that a client can consume the messages published only after subscribing to a topic and must continue to be active in order to keep consuming the messages on the topic.
I hope we all are clear on the very basics and I will soon come up with a working example on JMS to make things even more clear.