user manual

216 BES Developers Guide
Naming Support and Configuration
<message-driven>
<ejb-name>MyMDBTopic</ejb-name>
...
<connection-factory-name>serial://resources/tcf</connection-factory-name>
Now, we need to specify the JNDI name of the individual queue or topic. This
is done with the <message-driven-destination> element. Let's have a look at its
DTD entry.
<!ELEMENT message-driven-destination-name (#PCDATA)>
This is yet another simple element. It's value is essentially identical to the
value of the <jndi-name> element found within the <resource-env-ref>
declaration discussed above. Now our XML looks like the following:
<message-driven>
<ejb-name>MyMDBTopic</ejb-name>
...
<message-driven-destination>serial://resources/tcf</message-driven-
destination>
<connection-factory-name>serial://resources/tcf</connection-factory-name>
...
</message-driven>
Once deployed, you can access datasources from the MDB MyMDBTopic.
The connection factory objects are much like JDBC datasources and the
names of topics and queues are similar to specifying a database table name.
The connection factory objects themselves are typed, for example
TopicConnectionFactory and QueueConnectionFactory, depending upon what you
are listening for. Furthermore, each of subtype of XA flavor is are needed
when global transactions are in effect. In the typical development
environment, there is only one JMS service provider, so only a pair of
connection factories are required: one for topics and one for queues. Go to
Chapter 23, Using JMS, Configuring JMS Connection Factories section for
more information on configuring these.
Note You must use an XA connection factory when the MDB is deployed with the
REQUIRED transaction attribute. The whole idea of this deployment is to enable
the consumption of the message that drives the MDB to share the same
transaction as any other work that is done from within the MDB.onMessage()
method. To achieve this the container performs XA coordination with the JMS
service provider and any other resources enlisted in the transaction.