O'Reilly - Java Message Service
O'Reilly - Java Message Service
O'Reilly - Java Message Service
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Java</strong> <strong>Message</strong> <strong>Service</strong><br />
Chapter 1. Understanding the Messaging Paradigm<br />
Computers and people can communicate by using messaging systems to exchange<br />
messages over electronic networks. The most ubiquitous messaging system today is email,<br />
which facilitates communication among people. While email is an important human-tohuman<br />
messaging system, this book is not about email. Instead, this book is concerned<br />
with messaging systems that allow different software applications to communicate with<br />
each other. These application-to-application messaging systems, when used in business<br />
systems, are generically referred to as enterprise messaging systems, or <strong>Message</strong>-Oriented<br />
Middleware (MOM).<br />
Enterprise messaging systems allow two or more applications to exchange information in<br />
the form of messages. A message, in this case, is a self-contained package of business data<br />
and network routing headers. The business data contained in a message can be anything -<br />
depending on the business scenario - and usually contains information about some<br />
business transaction. In enterprise messaging systems, messages inform an application of<br />
some event or occurrence in another system.<br />
Using <strong>Message</strong>-Oriented Middleware, messages are transmitted from one application to<br />
another across a network. MOM products ensure that messages are properly distributed<br />
among applications. In addition, MOMs usually provide fault tolerance, load balancing,<br />
scalability, and transactional support for enterprises that need to reliably exchange large<br />
quantities of messages.<br />
MOM vendors use different message formats and network protocols for exchanging<br />
messages, but the basic semantics are the same. An API is used to create a message, give it<br />
a payload (application data), assign it routing information, and then send the message. The<br />
same API is used to receive messages produced by other applications.<br />
In all modern enterprise messaging systems, applications exchange messages through<br />
virtual channels called destinations. When a message is sent, it's addressed to a destination,<br />
not a specific application. Any application that subscribes or registers an interest in that<br />
destination may receive that message. In this way, the applications that receive messages<br />
and those that send messages are decoupled. Senders and receivers are not bound to each<br />
other in any way and may send and receive messages as they see fit.<br />
All MOM vendors provide application developers with an API for sending and receiving<br />
messages. While a MOM vendor implements its own networking protocols, routing, and<br />
administration facilities, the basic semantics of the developer API provided by different<br />
MOMs are the same. This similarity in APIs makes the <strong>Java</strong> <strong>Message</strong> <strong>Service</strong> possible.<br />
The <strong>Java</strong> <strong>Message</strong> <strong>Service</strong> (JMS) is a vendor-agnostic <strong>Java</strong> API that can be used with<br />
many different MOM vendors. JMS is analogous to JDBC in that application developers<br />
reuse the same API to access many different systems. If a vendor provides a compliant<br />
service provider for JMS, then the JMS API can be used to send and receive messages to<br />
that vendor. For example, you can use the same JMS API to send messages using Progress'<br />
SonicMQ as you do IBM's MQSeries. It is the purpose of this book to explain how<br />
enterprise messaging systems work and in particular how the <strong>Java</strong> <strong>Message</strong> <strong>Service</strong> is used<br />
6