Chapter 6
259
they are stateless, any instance of a matching type of message driven bean can
handle the message.
Implementing a message driven bean is straightforward. The bean developer
extends the
javax.ejb.MessageDrivenBean
interface and a message listener inter
face for the bean the message listener interface corresponds to the enterprise's
messaging system. For enterprises using JMS, the developer extends the
javax.jms.MessageListener
interface. A developer may embed business logic to
handle particular messages within the
MessageListener
methods. For example,
when a message driven bean consumes JMS messages, the developer codes the
message handling business logic within the
onMessage
method. When a message
appropriate for this bean arrives at a message destination, the EJB container
invokes the message driven bean's
onMessage
method.
With message driven beans, you can make the invocation of the bean part of a
transaction. That is, you can ensure that the message delivery from the message
destination to the message driven bean is part of any subsequent transactional
work initiated by the bean's logic. If problems occur with the subsequent logic
causing the transaction to roll back, the message delivery also rolls back and the
message is redelivered to another message driven bean instance.
6.2.3 EIS Access Technologies
The J2EE 1.4 platform includes the J2EE Connector architecture, a technology
designed specifically for accessing enterprise information systems (EISs). The Con
nector architecture simplifies integrating diverse EISs into the platform, since
each EIS can use the same, single resource adapter to integrate with all compliant
J2EE servers.
The J2EE Connector architecture provides a standard architecture for integrat
ing J2EE applications with existing EISs and applications, and particularly for data
integration with non relational databases. The Connector architecture enables
adapters for external EISs to be plugged into the J2EE application server. Enter
prise applications can use these adapters to support and manage secure, transac
tional, and scalable, bi directional communication with EISs. The EIS vendor
knows that its adapter will work with all J2EE compliant application servers, and
the compliant J2EE server can connect to multiple EISs. See Figure 6.3.
<
New Page 1
Clan Web Hosting