Chapter 14. Java Message Service
The Java Message Service is defined as JSR 343, and the complete specification can be downloaded.
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
A Java program 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. They typically refer to
ConnectionFactoryandDestination, and are identified by a JNDI name. TheConnectionFactoryis used to create a connection with the provider. TheDestinationis the object used by the client to specify the destination of messages it is sending and the source of messages it is receiving.
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access