- Introduction
- Message-Driven Bean Logical Component Architecture
- Message-Driven Bean Client Interfaces
- Message-Driven Bean Configuration and Deployment
- Conclusions
Message-Driven Bean Configuration and Deployment
In the third article in this series, I introduced the basic top-level structure of an EJB application module deployment descriptor. The root <ejb-jar> element contained an <enterprise-beans> element, which (new to EJB v2.0) can contain a collection of <message-driven> elements. Each <message-driven> element is used to describe the configuration and deployment of an individual message-driven bean.
The <message-driven> bean element, shown in Listing 1, defines message-driven bean metadata, a unique name of the bean, the bean's class name, configuration parameters, security semantics, transaction semantics, an optional selector statement used to select a particular bean to receive particular messages, a message-acknowledgement mode, and a description of the particular messaging model implied by the bean (topic or queue). The message-drivenrelated elements of an example message-driven bean's ejb-jar.xml file are shown in Listing 1.
Listing 1 Example of EJB Message-Driven Bean Deployment Descriptor Information
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> <ejb-jar> <description>A Message Driven EJB</description> <display-name>Asynchronous Beans Example</display-name> <enterprise-beans> <message-driven> <description/> <display-name>B2B Supply Chain Manager </display-name> <ejb-name>SupplyManagerEJB</ejb-name> <ejb-class> com.assuredtech.supply.SupplyManagerEJB </ejb-class> <transaction-type>Container</transaction-type> <message-driven-destination> <destination-type>javax.jms.Queue</destination-type> </message-driven-destination> </message-driven> </enterprise-beans> ... </ejb-jar>
Vendor-specific deployment descriptor files to configure and deploy message driven beans are also needed. Developers most often use GUI-based deployment tools provided by vendors to develop such files.