Sun Java System Application Server Platform Edition 9 Administration Guide
  Procure somente este livro
Fazer download desta apostila em PDF (1637 KB)

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, you can 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 Java EE 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: