| Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.5.0) Part Number E13981-01 |
|
|
View PDF |
You can access a JMS destination (queue or topic) and JMS connection resource manager connection factory by creating an environment reference to them using deployment XML (see "Using Deployment XML").
Note:
In EJB 3.0, an environment reference to a resource manager connection factory is not needed. You can access a resource manager connection factory directly using annotations and resource injection (see "Looking Up an EJB 3.0 Resource Manager Connection Factory").For information on looking up a resource manager connection factory, see the following:
To define a reference to a JMS destination and JMS connection resource manager connection factory, do the following:
Configure your JMS service provider.
For more information, see the following:
Define the JNDI name for the JMS destination and connection factory.
For more information, see the following:
Define a logical name for the JMS destination and JMS connection factory:
How you define the logical names is the same regardless of what type of JMS provider you use.
Define a <resource-env-ref> element in the appropriate client deployment descriptor (see "Where do you Configure an EJB Environment Reference?") and configure the following subelements:
<resource-env-ref-name>: a logical name for the JMS destination resource manager connection factory.
<resource-env-ref-type>: The destination class type; either javax.jms.Queue or javax.jms.Topic.
Example 19-13 shows a <resource-env-ref> element for a JMS topic resource manager connection factory.
Define a <resource-ref> element in the same client deployment descriptor and configure the following subelements:
<res-ref-name>: a logical name for the JMS connection resource manager connection factory.
<res-type>: the connection factory class type; either javax.jms.QueueConnectionFactory or javax.jms.TopicConnectionFactory.
<res-auth>: the authentication responsibility; either Container or Bean.
<res-sharing-scope>: the sharing scope; either Shareable or Unshareable.
Example 19-14 shows a <resource-ref> element for a JMS topic connection resource manager connection factory.
Map the logical names to the actual JNDI names.
Define a <resource-env-ref-mapping> element in the corresponding OC4J-specific deployment descriptor (see "Where do you Configure an EJB Environment Reference?") and configure its name attribute to the JMS destination logical name (defined in the <resource-env-ref>), and its location attribute–to the JNDI name defined when you configured your JMS provider (see step 2).
Example 19-15 shows a <resource-env-ref-mapping> element for OEMS JMS.
Define a <resource-ref-mapping> element in the same OC4J-specific deployment descriptor (see "Where do you Configure an EJB Environment Reference?") and configure its name attribute to the JMS connection factory logical name (defined in the <resource-ref>), and its location attribute–to the JNDI name defined when you configured your JMS provider (see step 2).
Example 19-16 shows a <resource-ref-mapping> element for OEMS JMS.