Message-Driven Bean Configuration
For JMS clients, you can use webMethods Broker as a JMS provider as part of your application server messaging solution.
The configuration outlined here contains the same functionality as the customer request part of the standalone messaging example in this chapter; however, the client is configured to run as a container application. Messaging is managed by a message-driven bean (MDB), an entity bean, and the application server container.
The following figure identifies the high-level components of such a client:
Message-driven bean (MDB). The MDB encapsulates all the actions that are taken as a result of the asynchronous receipt of a message requesting customer information. Once a message is received, the MDB's
onMessage() method is invoked. The
onMessage() method, which runs inside the scope of a transaction, removes the incoming message from the message queue, updates the database, and sends a reply to the requesting
Broker client.
ejbCreate() and
ejbRemove() are methods that control the life cycle of the MDB.
Entity bean. The entity bean controls the mapping and sending of data to and from the application server database. In this client, the entity bean and MDB are called from within the same EJB container system and executed within the same JVM. Therefore, only the local client interfaces
LocalHome and
Local are required.
Application server container. The application server container manages the entity bean and MDB components. If container-managed persistence (CMP) is specified for the application server, the container manages many operations automatically that would normally be handled programmatically in a standalone JMS client. For example, the container manages all update, insert, and delete database operations needed to communicate with the application server database, as well as transactional operations such as commits and rollbacks.
Database. A standard database managed by the application server, such as a JDBC database.
For more information about configuring application servers for use with the
webMethods Broker that is used as a JMS provider, see
webMethods Messaging Publisher Reconnect.