The J2EETM Tutorial
Home
TOC
Index
PREV TOP NEXT Search
Feedback

deploytool Tips for Message-Driven Beans

Chapter 2 covered the basic steps for building and packaging enterprise beans. This section describes the tasks in deploytool that are necessary for message-driven beans. To view an example in deploytool, open the j2eetutorial/examples/ears/SimpleMessageApp.ear file and select SimpleMessageEJB from the tree view.

Specifying the Bean's Type and Transaction Management

You specify the type when you create the bean with the New Enterprise Bean wizard.

  1. To start the wizard, select FileNewEnterprise Bean.
  2. In the General dialog box of the wizard, select the Message-Driven radio button.
  3. In the Transaction Management dialog box, you may select either the Bean-Managed or Container-Managed radio button. If you select the Bean-Managed button, then in step 4 of the next section, you may select the acknowledgment type.

Setting the Message-Driven Bean's Characteristics

You may specify these settings in two places:

These settings are as follows:

  1. For the Destination Type, select either the Queue or Topic radio button. A queue uses the point-to-point messaging domain and may have at most one consumer. A topic uses the publish-subscribe messaging domain; it may have zero, one, or many consumers.
  2. In the Destination combo box, select the JNDI name of the destination that you have created administratively. For an example, see the section Creating the Queue. The destination is either a Queue or a Topic object; it represents the source of incoming messages and the target of outgoing messages.
  3. In the Connection Factory combo box, select the appropriate object, either a QueueConnectionFactory or a TopicConnectionFactory. These objects produce the connections through which J2EE components access the messaging service.
  4. If you've specified bean-managed transactions, then you may select the acknowledgment type--either Auto-Acknowledge or Duplicates-OK-- from the Acknowledgement combo box. The Auto-Acknowledge type instructs the session to automatically acknowledge that the bean has consumed the message. The Duplicates-OK type instructs the session to lazily acknowledge the delivery of messages; this type may result in duplicate messages, but it reduces session overhead.
  5. In the JMS Message Selector field, you may enter a statement that filters the messages received by the bean.

Figure 7-2 Message Tab of SimpleMessageEJB

Home
TOC
Index
PREV TOP NEXT Search
Feedback