Adding message destination references

The J2EE 1.4 specification provides a means for J2EE components to refer to message destination objects by using "logical" names called message destination references. You can use the deployment descriptor editors to define message destination references.

A message destination reference points to a message-driven bean (MDB) in an EJB module.

At deployment, the message destination references are bound to the administered message destinations in the target operational environment.

Restriction: Only the following minimum project levels can include message destination references:

  • J2EE 1.4 Application Clients

  • EJB 2.1 projects

  • 2.4 Web Applications

For each message destination reference that you define, a message-destination-ref element is added to the deployment descriptor for that application component. Message destination references are scoped to the application component where they are defined, so they are not accessible to other application components during run time. Other components can define message destination references with the same name without causing a name conflict.

To define a message destination reference:

  1. Open the Add Reference wizard from the deployment descriptor editor for your J2EE module.

  2. Select Message destination reference and click Next.

  3. In the project tree, select the message-driven enterprise bean that provides the message destination object that you want to reference.

  4. In the Name field, specify a name for the reference, or accept the default name provided by the wizard (recommended). The value entered in the Name field is used in the message-destination-ref-name entry in the deployment descriptor.

    The name of the message destination reference is relative to the java:comp/env context. For example, the name should be jms/BidQueue rather than java:comp/env/jms/BidQueue.

  5. Click Next.

  6. In the Type field, select the expected type of the referenced destination. For example, for a JMS destination, the type might be javax.jms.Queue. The value entered in this field is used in the message-destination-ref-type entry in the deployment descriptor.

  7. In the Usage field, indicate whether the message destination consumes or produces messages. The value specified here is used for the message-destination-ref-usage entry in the deployment descriptor.

  8. In the Description text area, enter a description for the reference.

  9. Click Finish.

 

Related concepts

Client Deployment Descriptor editor

 

Related tasks

Defining references in J2EE modules
Adding EJB references
Adding resource manager connection factory references
Adding resource environment references
Adding security role references
Adding Web service references