4

Introduction to JMS

What is JMS?

Java Message Service (JMS) API is a part of the Java Enterprise Edition (JEE) specification. JMS is all about sending and receiving messages between two or more clients. It is a specification that describes a method by which Java programs to create, send and receive messages.
JMS API enables communication that is loosely coupled and messaging that is asynchronous in nature.

What is Messages?
A message has been described in various ways by different specification. However it is an entity of the communication. It is bytes of data that is meaningful between the applications which use it. Messages are used to transfer information from one application to other ones which may or may not run in same platforms.
What is Messaging?
Messaging is communication between system components or different applications (in a distributed environment) which are loosely coupled unlike its peers like TCP sockets, CORBA or RMI.Advantage of messaging:
The advantages of messaging include the ability to integrate different platforms, reduce system bottlenecks, increase scalability and reliability of message delivery.

Architecture:
A JMS Application consists of the following components:
JMS Provider: A messaging system that implements the JMS specification.

Messaging using MOM in JMS

Messaging using MOM in JMS

In JMS Message Oriented Middleware (MOM) plays a vital role which differentiates messaging from its peers. MOM is a component that helps in message communication between two systems connected across network.  MOM ensures asynchronous form of communication, supports reliable message delivery and transaction control. The Middleware creates a distributed communications layer that insulates the application developer from the details of the various operating system and network interfaces.

List of some of the MOM Service Providers:

MOM Service Provider ProductsCompany
WeblogicOracle
MQSeriesIBM
JBOSSMQJBOSS
SoniqMQProgress
TIBCO EMSTIBCO
ActiveMQApache

JMS clients: Java applications that produce or receive messages.

  • JMS Producer / Publisher: A JMS client that creates and sends messages.
  • JMS Consumer/ Subscriber: A JMS client that receives messages.

Messages: Objects that are used to communicate information between JMS clients.

Administered objects: Pre-configured JMS objects that are created by an administrator for the use of JMS clients. These objects are isolated from the proprietary technology providers. This helps in JMS client’s portability.

Types of Messaging model:

Types of messaging domain model

Types of messaging domain model

As we discussed earlier a JMS application will have one or more JMS clients that exchange message asynchronously with the help of MOM.
There are two types of messaging model in JMS:

 

 

 

 

 

 

Point to Point Messaging in JMS

Point to Point Messaging in JMS

a) Point to Point (PTP): In the PTP diagram the point-to-point (PTP) domain or application has three primary components like 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. Queues retain all messages sent to them until the messages are consumed or until the messages timeouts.

 

 

 

 

 

Pub/Sub Messaging Model

Pub/Sub Messaging Model

b) Publisher/ Subscriber (Pub/Sub): In the Pub/Sub diagram clients address messages to a topic. Publishers and subscribers are generally anonymous and can dynamically publish or subscribe to the content hierarchy. Topics retain messages only as long as it takes to distribute them to current subscribers.

 

 

 

 

 

Point to PointPublisher/ Subscriber
Each message has only one consumerEach message can have multiple consumers.
Messages are first sent to the destination named Queue.Messages are first published in the destination called Topic.
A sender and a receiver of a message have no timing dependencies. The receiver can fetch the message whether or not it was running when the client sent the message.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 receiver acknowledges the successful processing of a message.Does not provide acknowledgement

Typical use of JMS in enterprise solutions:
a)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.
b)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.

In the next blogs we will explain more details on the implementation so keep watching this space. Please provide your feedback and comments on this article.

Filed in: Java, JEE, Random Tags: , , , , , , , , , , , , ,

Get Updates

Share This Post

Related Posts

4 Responses to "Introduction to JMS"

  1. Every time I try to access the web site, this message comes up: “403 Forbidden – You don’t have permission to access / on this server. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.” I’ve never experienced a issue like this before; is it through some wrong doing of mine, or maybe there a problem with the website itself?

  2. Gene Backers says:

    I think everything composed was very logical. However, think on this, suppose you composed a catchier title? I mean, I don’t wish to tell you how to run your blog, but suppose you added a post title to possibly grab people’s attention? I mean Introduction to JMS | IdioTechie is kinda plain. You should look at Yahoo’s front page and see how they create news headlines to grab people interested. You might try adding a video or a pic or two to get people excited about what you’ve written. In my opinion, it could bring your posts a little bit more interesting.

  3. Mouli kommineni says:

    Thanks for your explanation, it is much useful.

Leave a Reply

Submit Comment

© 2014 IdioTechie. All rights reserved.