Java Message Service (JMS)


Hi everybody, after a long time i came back with my blogs. This time we are going to learn about JMS.
JMS – Java Message Service is a very interesting topic in Java. In this blog we will learn theory part of JMS and for coding you have to wait for my next blog.

JMS definition
The Java Message Service is a Java API that allows applications to create, send, receive, and read messages.JMS enables the lossely coupled messaging.

JMS API features

1) Loosely coupled messaging

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 which message format and which 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.

Types of Messaging models
1) Point to Point (PTP): A point-to-point (PTP) product or application is built on the concept of message queues, senders, and receivers. Each message is addressed to a specific queue, and receiving clients extract messages from the queues established to hold their messages.

2) Publish/Subscribe Messaging Domain : In a publish/subscribe (pub/sub) product or application, clients address messages to a topic, which functions somewhat like a bulletin board. Publishers and subscribers are generally anonymous and can dynamically publish or subscribe to the content hierarchy.

When to use

1) JMS is useful where there might be requirement for pushing data to the consumers e.g. Bulletin board, News updates, Stock quotes, Auction websites etc.

2) Today the whole world is al about collaboration. Businesses and applications can interact with each other via messaging as JMS will allow them to integrate with each other without tight coupling.