Java Reference
In-Depth Information
The building blocks of JMS
The basic building blocks of any JMS application consist of the following:
• Administered objects—connection factories and destinations
• Connections
• Sessions
• Message producers
• Message consumers
• Messages
Let's take a closer look at them:
Connection factory : This object encapsulates a set of connection configuration
parameters that have been defined by an administrator. A client uses it to create a
connection with a JMS provider. A connection factory hides provider-specific de-
tails from JMS clients and abstracts administrative information into objects in the
Java programming language.
Destination : This is the component a client uses to specify the target of messages
it produces and the source of messages it consumes. In the point-to-point ( PTP )
messaging domain, destinations are called queues; in the publish/subscribe (pub/
sub) messaging domain, destinations are called topics.
Connection : This encapsulates a virtual connection with a JMS provider. A con-
nection could represent an open TCP/IP socket between a client and a provider ser-
vice. You use a connection to create one or more sessions.
Session : This is a single-threaded context for producing and consuming messages.
You use sessions to create message producers, message consumers, and messages.
Sessions serialize the execution of message listeners and provide a transactional
context with which to group a set of sends and receives into an atomic unit of
Message producer : This is an object created by a session and is used to send mes-
sages to a destination. The PTP form of a message producer implements the
QueueSender interface. The pub/sub form implements the TopicPublisher
interface. From JMS 2.0, it is possible to rely only on the JMSProducer inter-
Message consumer : This is an object created by a session and is used to receive
messages sent to a destination. A message consumer allows a JMS client to register
interest in a destination with a JMS provider. The JMS provider manages the deliv-
ery of messages from a destination to the registered consumers of the destination.
Search WWH ::

Custom Search