Java Reference
In-Depth Information
Chapter 20. Java Message Service Concepts
This chapter provides an introduction to the Java Message Service (JMS) API, a Java API
that allows applications to create, send, receive, and read messages using reliable, asyn-
chronous, loosely coupled communication. It covers the following topics:
• “
Overview of the JMS API
” on page
341
• “
Basic JMS API Concepts
”
on page
345
• “
The JMS API Programming Model
” on page
348
• “
Creating Robust JMS Applications
”
on page
359
• “
Using the JMS API in Java EE Applications
” on page
368
• “
Further Information about JMS
” on page
376
Overview of the JMS API
This overview defines the concept of messaging, describes the JMS API and when it can
be used, and explains how the JMS API works within the Java EE platform.
What Is Messaging?
Messaging is a method of communication between software components or applications.
A messaging system is a peer-to-peer facility: A messaging client can send messages to,
and receive messages from, any other client. Each client connects to a messaging agent that
provides facilities for creating, sending, receiving, and reading messages.
Messaging enables distributed communication that is
loosely coupled
. A component sends
a message to a destination, and the recipient can retrieve the message from the destination.
However, the sender and the receiver do not have to be available at the same time in order
to communicate. In fact, the sender does not need to know anything about the receiver;
nor does the receiver need to know anything about the sender. The sender and the receiv-
er need to know only which message format and which destination to use. In this respect,
messaging differs from tightly coupled technologies, such as Remote Method Invocation
(RMI), which require an application to know a remote application's methods.
Messaging also differs from electronic mail (email), which is a method of communication
between people or between software applications and people. Messaging is used for com-
munication between software applications or software components.