next up previous contents
Next: Enterprise JavaBeans (EJB) Up: Java Enterprise Computing Previous: Java Enterprise Computing   Contents

Java Message Service

Java Message Service (JMS) [35], designed by Sun Microsystems and several partner companies provides standard APIs that allows applications to create, send, receive, and read messages. It has been a part of the Java 2 Enterprise Edition since release 1.2. Java programs can exchange messages with other Java programs by sharing a messaging system in JMS. A messaging system, sometimes called Message-Oriented Middleware (MOM), accepts messages from ``producer'' clients and delivers them to ``consumer'' clients. Messaging systems are peer-to-peer distributed systems in the sense that every registered client can communicate with every other registered client. The term messaging is used to describe asynchronous communication between enterprise applications. JMS supports point-to-point (PTP) and publish/subscribe message passing strategies. The PTP message model is based on message queues. A QueueSender class (producer) sends a message to a specified queue. A QueueReceiver class (consumer) receives messages from the queue. The publish/subscribe messaging model is organized around topics. A TopicPublishers class (producer) sends messages to a topic. A TopicSubscribers class (consumer) retrieves messages from a topic. JMS also supports both synchronous and asynchronous message passing. A JMS application is composed of the following parts: a JMS provider, JMS clients, messages, administered objects, and native clients. A JMS provider is a messaging product that implements the JMS interfaces and provides administrative and control features. JMS clients are programs or components written in the Java programming language that produce and consume messages. Messages are the objects that communicate information between JMS clients. An administrator creates administered objects, which are JMS objects, for use of client. There are two kinds of administered objects: destinations and connection factories. A client uses a destination object to specify the target and the source of messages. Connection configurations that have been defined by the administrator are contained in a connection factory. Native clients are programs that use a messaging product's native client API instead of the JMS API. Figure 2.2 illustrates the way these parts interact. After we bind destinations and connection factories into a Java Naming Directory Interface (JNDI) namespace, a JMS client looks up the administered objects in the namespace. Then the JMS provider provides the same objects for a logical connection to the JMS client.
Figure 2.2: The JMS API Architecture
\begin{figure}
\centerline{\epsfig{figure=Figs/JMS.eps}}
\end{figure}
Unlike the Remote Procedure Call (RPC) synchronous model, where we block and wait until each system finishes processing a task, a fundamental concept of MOM is that communication between applications is asynchronous. Code that is written to communicate assumes there is a one-way message that requires no immediate response from another application. There is also a high degree of anonymity between producer and consumer. Information about the owner of produced message is not important for the message consumer. This anonymity helps provide dynamic, reliable, and flexible systems.
next up previous contents
Next: Enterprise JavaBeans (EJB) Up: Java Enterprise Computing Previous: Java Enterprise Computing   Contents
Bryan Carpenter 2004-06-09