Configuring a Message Driven Bean to Use
a Resource Adapter

The Connectors specification’s message inflow contract
provides a generic mechanism to plug in a wide-range of message providers,
including JMS, into a Java-EE-compatible application server. Message
providers use a resource adapter and dispatch messages to message
endpoints, which are implemented as message-driven beans.

The message-driven bean developer provides activation configuration
information in the message-driven bean’s ejb-jar.xml file.
Configuration information includes messaging-style-specific configuration
details, and possibly message-provider-specific details as well. The
message-driven bean deployer uses this configuration information to
set up the activation specification JavaBean. The activation configuration
properties specified in ejb-jar.xml override configuration
properties in the activation specification definition in the ra.xml file.

According to the EJB specification, the messaging-style-specific
descriptor elements contained within the activation configuration
element are not specified because they are specific to a messaging
provider. In the following sample message-driven bean ejb-jar.xml, a message-driven bean has the following activation configuration
property names: destinationType, SubscriptionDurability, and MessageSelector.

When the message-driven bean is deployed, the value for
the resource-adapter-mid element in the sun-ejb-jar.xml file is set to the resource adapter module name that delivers
messages to the message endpoint (to the message-driven bean). In
the following example, the jmsra JMS resource adapter,
which is the bundled resource adapter for the Sun GlassFish Message Queue message
provider, is specified as the resource adapter module identifier for
the SampleMDB bean.

When the message-driven bean is deployed, the Enterprise Server uses
the resourceadapter-mid setting to associate the
resource adapter with a message endpoint through the message inflow
contract. This message inflow contract with the application server
gives the resource adapter a handle to the MessageEndpointFactory and the ActivationSpec JavaBean, and
the adapter uses this handle to deliver messages to the message endpoint
instances (which are created by the MessageEndpointFactory).

When a message-driven bean first created for use on the Enterprise Server 7
is deployed, the Connector runtime transparently transforms the previous
deployment style to the current connector-based deployment style.
If the deployer specifies neither a resource-adapter-mid property
nor the Message Queue resource adapter’s activation configuration
properties, the Connector runtime maps the message-driven bean to
the jmsra system resource adapter and converts
the JMS-specific configuration to the Message Queue resource adapter’s
activation configuration properties.