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
ConnectionFactory
andDestination
, and are identified by a JNDI name. TheConnectionFactory
is used to create a connection with the provider. TheDestination
is 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 ...
Get Java EE 7 Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.