Configure Borland Enterprise Server for the Example Message Driven Bean


Borland Enterprise Server contains an example MDB in the C:\<BES-install-dir>\examples\ejb\mdb directory. The example consists of the MDB HelloBean.java and the client MdbClient.java. The same bean can be used to consume messages from both queues and topics.

The MDB is defined in the standard ejb-jar.xml deployment descriptor file. This file defines two EJBs, one named HelloEJBQueue and another named HelloEJBTopic. Both beans are implemented as the same class, com.borland.examples.ejb.mdb.HelloBean. This class can be used for this example without modification.

Using Container-Managed XA Transactions

If you want to use container managed XA transactions with the HelloEJBQueue MDB, make the following changes to the deployment descriptors, ejb-jar.xml and ejb-borland.xml.

In ejb-jar.xml, make the changes in bold:
<ejb-jar> 
    <enterprise-beans> 
        <message-driven> 
            <ejb-name>HelloEJBQueue</ejb-name> 
            <ejb-class> 
               com.borland.examples.ejb.mdb.HelloBean</ejb-class> 
            <transaction-type>Container</transaction-type> 
            <message-driven-destination> 
                <destination-type>javax.jms.Queue</destination-type> 
            </message-driven-destination> 
            <env-entry> 
                <env-entry-name> 
                   messageAcknowledgement</env-entry-name> 
                <env-entry-type>java.lang.String</env-entry-type> 
                <env-entry-value>&lt;HelloEJBQueue&gt; Got a message 
                     from queue TibQ1:</env-entry-value> 
            </env-entry> 
        </message-driven> 
        <message-driven> 
            <ejb-name>HelloEJBTopic</ejb-name> 
            <ejb-class> 
               com.borland.examples.ejb.mdb.HelloBean</ejb-class> 
            <transaction-type>Bean</transaction-type> 
            <acknowledge-mode>Auto-acknowledge</acknowledge-mode> 
            <message-driven-destination> 
                <destination-type>javax.jms.Topic</destination-type> 
                <subscription-durability> 
                    Durable</subscription-durability> 
            </message-driven-destination> 
            <env-entry> 
                <env-entry-name> 
                   messageAcknowledgement</env-entry-name> 
                <env-entry-type>java.lang.String</env-entry-type> 
                <env-entry-value>&lt;HelloEJBTopic&gt; Got a message 
                   from topic TibT1:</env-entry-value> 
            </env-entry> 
        </message-driven> 
    </enterprise-beans> 
    <assembly-descriptor> 
        <container-transaction> 
            <method> 
                <ejb-name>HelloEJBQueue</ejb-name> 
                <method-name>*</method-name> 
            </method> 
            <trans-attribute>Required</trans-attribute> 
        </container-transaction> 
    </assembly-descriptor> 
</ejb-jar> 
In ejb-borland.xml, make the changes in bold:
<ejb-jar> 
    <enterprise-beans> 
        <message-driven> 
            <ejb-name>HelloEJBQueue</ejb-name> 
            <message-driven-destination-name> 
               serial://jms/tibq</message-driven-destination-name> 
            <connection-factory-name> 
               serial://jms/tibxaqcf</connection-factory-name> 
            <pool> 
                <max-size>20</max-size> 
                <init-size>2</init-size> 
            </pool> 
        </message-driven> 
        <message-driven> 
            <ejb-name>HelloEJBTopic</ejb-name> 
            <message-driven-destination-name> 
               serial://jms/tibt</message-driven-destination-name> 
            <connection-factory-name> 
                serial://jms/tibtcf</connection-factory-name> 
            <pool> 
                <max-size>20</max-size> 
                <init-size>2</init-size> 
            </pool> 
        </message-driven> 
    </enterprise-beans> 
</ejb-jar> 

Using XA Transactions That Are Not Container-Managed

If you do not want to use container managed XA transactions with the HelloEJBQueue MDB, make the following changes to the deployment descriptors, ejb-jar.xml and ejb-borland.xml.

In ejb-jar.xml, make the changes in bold:
<ejb-jar> 
    <enterprise-beans> 
        <message-driven> 
            <ejb-name>HelloEJBQueue</ejb-name> 
            <ejb-class> 
               com.borland.examples.ejb.mdb.HelloBean</ejb-class> 
            <transaction-type>Container</transaction-type> 
            <message-driven-destination> 
                <destination-type>javax.jms.Queue</destination-type> 
            </message-driven-destination> 
            <env-entry> 
                <env-entry-name> 
                  messageAcknowledgement</env-entry-name> 
                <env-entry-type>java.lang.String</env-entry-type> 
                <env-entry-value>&lt;HelloEJBQueue&gt; Got a message 
                    from queue TibQ1:</env-entry-value> 
            </env-entry> 
        </message-driven> 
        <message-driven> 
            <ejb-name>HelloEJBTopic</ejb-name> 
            <ejb-class> 
               com.borland.examples.ejb.mdb.HelloBean</ejb-class> 
            <transaction-type>Bean</transaction-type> 
            <acknowledge-mode>Auto-acknowledge</acknowledge-mode> 
            <message-driven-destination> 
                <destination-type>javax.jms.Topic</destination-type> 
                <subscription-durability> 
                   Durable</subscription-durability> 
            </message-driven-destination> 
            <env-entry> 
                <env-entry-name> 
                   messageAcknowledgement</env-entry-name> 
                <env-entry-type>java.lang.String</env-entry-type> 
                <env-entry-value>&lt;HelloEJBTopic&gt; Got a message 
                    from topic TibT1:</env-entry-value> 
            </env-entry> 
        </message-driven> 
    </enterprise-beans> 
    <assembly-descriptor> 
        <container-transaction> 
            <method> 
                <ejb-name>HelloEJBQueue</ejb-name> 
                <method-name>*</method-name> 
            </method> 
            <trans-attribute>NotSupported</trans-attribute> 
        </container-transaction> 
    </assembly-descriptor> 
</ejb-jar> 
In ejb-borland.xml, make the changes in bold:
<ejb-jar> 
    <enterprise-beans> 
        <message-driven> 
            <ejb-name>HelloEJBQueue</ejb-name> 
            <message-driven-destination-name> 
               serial://jms/tibq</message-driven-destination-name> 
            <connection-factory-name> 
               serial://jms/tibqcf</connection-factory-name> 
            <pool> 
                <max-size>20</max-size> 
                <init-size>2</init-size> 
            </pool> 
        </message-driven> 
        <message-driven> 
            <ejb-name>HelloEJBTopic</ejb-name> 
            <message-driven-destination-name> 
               serial://jms/tibt</message-driven-destination-name> 
            <connection-factory-name> 
               serial://jms/tibtcf</connection-factory-name> 
            <pool> 
                <max-size>20</max-size> 
                <init-size>2</init-size> 
            </pool> 
        </message-driven> 
    </enterprise-beans> 
</ejb-jar> 

TIBCO Enterprise Message Service™ Application Integration Guide
Software Release 4.3, February 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com