Java Reference
In-Depth Information
the management of these objects belongs with other administrative tasks that vary from
provider to provider.
JMS clients access these objects through interfaces that are portable, so a client application
can run with little or no change on more than one implementation of the JMS API. Ordin-
arily, an administrator configures administered objects in a JNDI namespace, and JMS cli-
ents then access them by using resource injection.
With GlassFish Server, you can use the asadmin create-jms-resource com-
mand or the Administration Console to create JMS administered objects in the form of
connector resources. You can also specify the resources in a file named glassfish-
resources.xml that you can bundle with an application.
NetBeans IDE provides a wizard that allows you to create JMS resources for GlassFish
Server. See “ To Create JMS Resources Using NetBeans IDE ” on page 381 for details.
JMS Connection Factories
A connection factory is the object a client uses to create a connection to a provider. A
connection factory encapsulates a set of connection configuration parameters that has
been defined by an administrator. Each connection factory is an instance of the Con-
nectionFactory , QueueConnectionFactory , or TopicConnectionFact-
ory interface. To learn how to create connection factories, see To Create JMS Resources
Using NetBeans IDE on page 381 .
At the beginning of a JMS client program, you usually inject a connection factory resource
into a ConnectionFactory object. For example, the following code fragment speci-
fies a resource whose JNDI name is jms/ConnectionFactory and assigns it to a
ConnectionFactory object:
Click here to view code image
@Resource(lookup = "jms/ConnectionFactory")
private static ConnectionFactory connectionFactory;
In a Java EE application, JMS administered objects are normally placed in the jms nam-
ing subcontext.
JMS Destinations
A destination is the object a client uses to specify the target of messages it produces and
the source of messages it consumes. In the PTP messaging domain, destinations are called
queues. In the pub/sub messaging domain, destinations are called topics. A JMS applic-
ation can use multiple queues or topics (or both). To learn how to create destination re-
sources, see “ To Create JMS Resources Using NetBeans IDE ” on page 381 .
Search WWH ::




Custom Search