Message is a method of communication between a software component or application. A messaging client can send a message to other client and can receive a message from other client. Each client connects the Messaging agent to creating, sending , receiving and reading a Message.
The difference between E-mail and Messaging is :
E-mail is communication between people or between software applications and people.
Messaging is used for communication between software applications and software components.
Java Messaging Service is a Java API that allows applications to create, send, receive and read messages.
JMS applications features are:
1)Loosely coupled: A component sends a message to a destination, and the recipient can retrieve the message from the destination. However, the sender and the receiver do not have to be available at the same time in order to communicate. In fact, the sender does not need to know anything about the receiver; nor does the receiver need to know anything about the sender. The sender and the receiver need to know only what message format and what destination to use.
2)Asynchronous: A JMS provider can deliver messages to a client as they arrive; a client does not have to request messages in order to receive them.
3)Reliable: The JMS API can ensure that a message is delivered once and only once. Lower levels of reliability are available for applications that can afford to miss messages or to receive duplicate messages.
You can use the Java API in the fallowing situations:
I)The you want the components not to depend on information about other components’ interfaces, so that components can be easily replaced.
II)The provider wants the application to run whether or not all components are up and running simultaneously.
III)The application business model allows a component to send information to another and to continue to operate without receiving an immediate response.
JMS application is composed of fallowing parts:
1) JMS provider: It is a messaging system that implements JMS interfaces and provides administrative and control features.
2)JMS Clients: These are the programs or components written in Java programing language, that produce and consume messages.
3)Messages: These are the objects that communicate information between JMS clients.
4)Administered objects: These are preconfigured JMS objects created by an administer for the use of clients. The two kinds of Administered objects are destinations and connection factories.
5)Native Clients: these are the programs that use a messaging product’s native client api instead of JMS api.
Fallowing figure illustrate the way these parts interacts:
JMS provides the two types of domain applications
1)Point- to- Point Messaging domain.
2)Publish/Subscribe Messaging domain.
1)Point-to-point Messaging domain:
PTP messaging have fallowing characteristics
→ Each message has only one consumer.
→ A sender and receiver of a message have no timing dependencies. The receiver can fetch the message whether or not it was running when the client sends the message.
→ The receiver acknowledges the successful processing of message.
Use PTP when every message you send must be processed successfully by one consumer.
2)Publish/Subscribe Messaging domain:
pub/sub messaging have fallowing characteristics.
→ Each message may have multiple consumers
→ Publishers and subscribers have a timing dependency. A client that subscribes to a topic can consume only messages published after the client has created a subscription, and the subscriber must continue to be active in order for it to consume messages.
The basic building blocks of a JMS application consist of
Administered objects:Connection factories and destinations Connections
These building blocks explained one by one as fallows.