Overview
Message-Oriented-Middleware provide a common reliable way for programs
to create, send, receive and read messages in any distributed Enterprise
System. MOM ensures fast, reliable asynchronous electronic communication,
guaranteed message delivery, receipt notification and transaction
control.
The Java Message Service (JMS) provides a standard Java-based interface
to the message services of a MOM of some other provider.
Messaging systems can either be:
- Asynchronous
- Synchronous
and can be classified into different models that determine which
client receives a message. The most common messaging models are:
- Publish-Subscribe Messaging
- Point-To-Point Messaging
- Request-Reply Messaging
Not all MOM providers support all these models.
1. Asynchronous messaging
Advantages:
- Loose coupling between sender and receiver
- Does not block sender
- Network does not need to be available, messages can be queued
- Least demanding on communication mechanisms
Disadvantages:
Good for publish-subscribe
2. Synchronous messaging
Advantages:
- Good for transaction processing
- Fail-safe communication
- Coping with error situations
Disadvantages:
- Tight coupling between sender and receiver
- Blocks sender until receiver is finished processing
- Network must be available
- More demanding on communication mechanisms
a. Publish-Subscribe Messaging
Publish-Subscribe Messaging is used when there may be multiple
Senders and multiple Receivers.
The central concept in a Publish-Subscribe messaging system is
the Topic. Multiple Publishers may send messages to a Topic, and
all Subscribers to that Topic receive all the messages sent to that
Topic.
b. Point-To-Point Messaging
Point-To-Point Messaging is used when one or more senders need
to send messages to a single receiver.
The client to a Messaging system may only send messages, only receive
messages, or send and receive messages. At the same time, another
client can also send and/or receive messages.
There are two basic types of Point-to-Point Messaging systems.
The first one involves a client that directly sends a message to
another client. The second and more common implementation is based
on the concept of a Message Queue. In this situation each message
is addressed to a specific queue; clients get messages from the
queue(s) created to hold their messages
c. Request-Reply Messaging
When an application sends a message and expects to receive a message
in return, Request-Reply Messaging can be used. This is the standard
synchronous object-messaging format. This messaging model is often
defined as a subset of one of the other two models.
JMS does not explicitly support Request-Reply Messaging, though
it allows it in the context of the other methods.
Java Messaging Service (JMS)
JMS provides a common way for Java programs to create, send, receive
and read an enterprise messaging systems messages.
The primary features of JMS are as follows:
- Connection Factories are used in JMS to create connections to
a specific JMS provider.
- In JMS, both Publish-Subscribe Messaging and Point-To-Point
are implemented and defined by separate interfaces so that a Provider
does not have to support both.
- JMS defines the concept of a Topic or a Queue as the target
for a Message. Topics are used for Publish-Subscribe Messaging.
Queues are used for Point-to-Point Messaging.
- The Providers code is defined by interfaces in JMS, freeing
the implementation from the limitations of subclassing.
- JMS provides support for distributed transactions.
JMS Service Providers implement the JMS interface on top of their
messaging services. JMS defines Queues and Topics, but it does not
require the provider to implement both. JMS thus tries to maximize
portability of the solution with as many features as possible.
Nothing prevents a JMS application from combining PTP and publish-subscribe
but JMS focuses on applications that use one approach or the other.
JMS does NOT include the following:
- Load balancing/fault tolerance
- Error/advisory notification
- Administration
- Security
- Wire protocol
- Message Type Repository
|