Chapter 10. Java Message Service
Java Message Service is defined as JSR 914, and the complete specification can be downloaded from http://jcp.org/aboutJava/communityprocess/final/jsr914/index.html.
Message-oriented middleware (MOM) allows sending and receiving messages between distributed systems. Java Message Service (JMS) is a MOM that provides a way for Java programs to create, send, receive, and read an enterprise messaging system’s messages.
JMS defines the following concepts:
- JMS Provider
An implementation of the JMS interfaces, included in a Java EE implementation.
- JMS Client
An application or process that produces and/or receives messages. Any Java EE application component can act as a JMS client.
- JMS Message
An object that contains the data transferred between JMS clients. A JMS producer/publisher creates and sends messages. A JMS consumer/subscriber receives and consumes messages.
- Administered Objects
Objects created and preconfigured by an administrator. Typically refer to JMS Destinations and Connection Factories identified by a JNDI name.
JMS supports two messaging models: Point-to-Point and Publish-Subscribe.
In the Point-to-Point model, a publisher sends a message to a specific destination, called a queue, targeted to a subscriber. Multiple publishers can send messages to the queue, but each message is delivered and consumed by one consumer only. Queues retain all messages sent to them until the messages are consumed or expire.
In the Publish-Subscribe model, a publisher publishes ...