208 Patterns: Implementing Self-Service in an SOA Environment
Each listener monitors either a JMS queue destination for point-to-point
messaging, or a JMS topic destination for publish/subscribe messaging.
A connection factory is used to create connections with the JMS provider for a
specific JMS queue or topic destination. Each connection factory encapsulates
the configuration parameters needed to create a connection to a JMS
destination.
A listener port defines the association between a connection factory, a
destination, and a deployed message-driven bean. Listener ports are used to
simplify the administration of the associations between these resources.
When a deployed message-driven bean is installed, it is associated with a
listener port and the listener for a destination. When a message arrives on the
destination, the listener passes the message to a new instance of a
message-driven bean for processing.
When an application server is started, it initializes the listener manager based on
the configuration data. The listener manager creates a dynamic session thread
pool for use by listeners, creates and starts listeners, and during server
termination controls the cleanup of listener message service resources. Each
listener completes several steps for the JMS destination that it is to monitor,
including:
򐂰 Creating a JMS server session pool, and allocating JMS server sessions and
session threads for incoming messages.
򐂰 Interfacing with JMS ASF to create JMS connection consumers to listen for
incoming messages.
򐂰 If specified, starting a transaction and requesting that it is committed (or rolled
back) when the EJB method has completed.
򐂰 Processing incoming messages by invoking the onMessage() method of the
specified enterprise bean.
7.5.4 Managing JMS objects
JMS Connection is the first point of access to JMS objects. JMS Connection is
created from JMS ConnectionFactory. Once a connection is created, one or
more sessions can be created in the context of the connection. JMS Sessions
allow you to create message consumers and producers. When consumers or
producers are created, the connection needs to be started to receive or send
messages. JMS Connections can be cached, similar to the way EJB home
objects are cached, and reused by many clients.
JMS Sessions are designed for synchronous access only. A session can only be
used by a single client and not shared among other clients. Similarly, an instance

Get Patterns: Implementing Self-Service in an SOA Environment 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.