Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (10.1.3.1.0)

Part Number B28221-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Configuring an EJB 2.1 MDB to Access a Message Service Provider Directly

You can configure an EJB 2.1 MDB to access a message service provider directly (without a J2CA resource adapter).

Note:

Oracle recommends that you access a message service provider using a J2CA resource adapter such as the Oracle JMS Connector. For more information, see:

You can do this by using deployment XML (see "Using Deployment XML").

OC4J supports both XA factories for two-phase commit (2PC) transactions and non-XA factories for transactions that do not require 2PC. For more information on 2PC support, see "How do You Participate in a Global or Two-Phase Commit (2PC) Transaction?".

Using Deployment XML

To configure an EJB 2.1 MDB to access a JMS message service provider directly (without a J2CA resource adapter) by using deployment XML, you can use either the ejb-jar.xml or orion-ejb.jar.xml file. You use the orion-ejb-jar.xml file configuration to override settings in ejb-jar.xml or to add OC4J-specific settings. For example, the connection factory and destination name that you define in ejb-jar.xml may be logical names that may not exist in your local JNDI environment. The deployer can override these settings in the orion-ejb-jar.xml file and map them to the actual names. For more information on mapping logical names, see "Configuring an Environment Reference to a JMS Destination or Connection Resource Manager Connection Factory (JMS 1.0)".

To configure

  1. Specify the required activation configuration properties.

    You may specify activation configuration properties using any combination of <config-property> elements in the orion-ejb-jar.xml file <message-driven-deployment> element and <activation-config-property> elements in the ejb-jar.xml file <message-driven> element (as Example 18-3 shows). The orion-ejb-jar.xml file configuration overrides that in the ejb-jar.xml file.

    For more information, see:

Example 18-3 shows how to configure ejb-jar.xml to configure a message-driven bean to use a non-J2CA JMS message service provider. It assumes that you defined connection factory jms/MyQCF and queue jms/MyQueue when you configured your message service provider. You can define either XA-enabled factories for two-phase commit (2PC) support or non-XA factories if 2PC support is not required. For more information, see "Configuring Message Services".

Example 18-3 ejb-jar.xml for a Non-J2CA Message Service Provider

<message-driven>
    <ejb-name>QueueMDB</ejb-name>
    <ejb-class>test.QueueMDB</ejb-class>
    <message-destination-type>javax.jms.Queue</message-destination-type>
    <transaction-type>Container</transaction-type>

    <activation-config>
        <activation-config-property>
            <activation-config-property-name>
                ConnectionFactoryJndiName
            </activation-config-property-name>
            <activation-config-property-value>
                jms/MyQCF
            </activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
            <activation-config-property-name>
                DestinationName
            </activation-config-property-name>
            <activation-config-property-value>
                jms/MyQueue
            </activation-config-property-value>
        </activation-config-property>
    </activation-config>
</message-driven>

The actual names you use depend on your message service provider installation. For more information, see the following: