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 destination that is defined in an EJB module, application client module, or dynamic Web 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.

Message destination links (the message-destination-link element) can be defined on message-driven beans and message destination references. The message-destination-link element of the message-destination-ref element of an enterprise bean produces messages to link to a target destination. The value for the message-destination-link element is the name of a message destination.

<message-destination-ref>
	<description></description>
	<message-destination-ref-name>MyDest_Ref</message-destination-ref-name>
	<message-destination-type>java.net.URL</message-destination-type>
	<message-destination-usage>Produces</message-destination-usage>
	<message-destination-link>MyDest</message-destination-link>
</message-destination-ref>

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 Name field, specify a name for the reference. 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.

  4. In the project tree, select the message destination that you want to reference. You can click New Destination to add a new message destination to the deployment descriptor for your current project.
    Note: The wizard allows you to finish without linking the reference to a message destination, but you will need to add the link later in the deployment descriptor.
  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
Adding message destinations
Terms of use | Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.