Java Message Services
In this section, you will read about the java
messages Services (JMS). This tutorial provides an overview of the JMS and
offers the basics for developing programs using it. The java message services
API is a java Message oriented Middleware API for sending successfully the messages
asynchronously to the servers.
following some element of JMS:
The JMS provider implements the JMS interface
for a Message Oriented Middleware.
Client: An application or process that produces
and receives messages.
- JMS consumer: A JMS
client that receives messages.
- JMS Message: An object that contains the data
being transferred between JMS clients.
The JMS API supports two models:
- point to point or queuing model
- publish and subscribe model
point to point or queuing model
The point-to-point or queuing model, a producer posts messages to a particular queue and a consumer reads message from the queue. The point-to-point model support the some following
- Only one consumer will get the message
- The producer does not have to be running at the time the consumer consumes the message, nor
does the consumer need to be running at the time the message is sent.
Publish and subscribe model
The publish- subscribe model supports publishing messages to a particular message topic. In this model, neither the publisher nor the subscribe know about each other. The
following are the characteristics of this
- Multiple consumers can get the message.
- There is a timing dependency between publishers and subscribers. The publisher has to create a
subscription in order for clients to be able to subscribe.
JMS provides a way of separating the application from the transport layer of providing data. The same java class can be used to communicate with different JMS
providers by using the JNDI information for the desired provider.