Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Administration Guide

- Previous: The JMS Provider in the Application Server
- Next: The Relationship Between JMS Resources and Connector Resources

## JMS Resources

The Java Message Service (JMS) API uses two kinds of administered objects:

- Connection factories, objects that allow an application to create other JMS objects programmatically

- Destinations, which serve as the repositories for messages

These objects are created administratively, and how they are created is specific to each implementation of JMS. In the Application Server, perform the following tasks:

- Create a connection factory by creating a connection factory resource

- Create a destination by creating two objects:

  - A physical destination

  - A destination resource that refers to the physical destination

JMS applications use the JNDI API to access the connection factory and destination resources. A JMS application normally uses at least one connection factory and at least one destination. To learn what resources to create, study the application or consult with the application developer.

There are three types of connection factories:

- `QueueConnectionFactory` objects, used for point-to-point communication

- `TopicConnectionFactory` objects, used for publish-subscribe communication

- `ConnectionFactory` objects, which can be used for both point-to-point and publish-subscribe communications; these are recommended for new applications

There are two kinds of destinations:

- `Queue` objects, used for point-to-point communication

- `Topic` objects, used for publish-subscribe communication

The chapters on JMS in the J2EE 1.4 Tutorial provide details on these two types of communication and other aspects of JMS (see `http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html`).

The order in which the resources are created does not matter.

For a J2EE application, specify connection factory and destination resources in the Application Server deployment descriptors as follows:

- Specify a connection factory JNDI name in a `resource-ref` or an `mdb-connection-factory` element.

- Specify a destination resource JNDI name in the `ejb` element for a message-driven bean and in the `message-destination` element.

- Specify a physical destination name in a `message-destination-link` element, within either a `message-driven` element of an enterprise bean deployment descriptor or a `message-destination-ref` element. In addition, specify it in the `message-destination` element. (The `message-destination-ref` element replaces the `resource-env-ref` element, which is deprecated in new applications.) In the `message-destination` element of an Application Server deployment descriptor, link the physical destination name with the destination resource name.

See Also:

- JNDI Names and Resources

- The Relationship Between JMS Resources and Connector Resources

- To create a JMS connection factory resource

- To create a JMS destination resource

- To create a JMS physical destination

- Previous: The JMS Provider in the Application Server
- Next: The Relationship Between JMS Resources and Connector Resources

- © 2010, Oracle Corporation and/or its affiliates