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

Part Number E13981-01
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 MDB for Oracle RAC Failover

If your MDB application uses OEMS JMS Database with an Oracle RAC database, you must configure your application to handle a database failover scenario, as follows:

Note:

The Oracle RAC-enabled attribute of a data source is discussed in Data Sources chapter in the Oracle Containers for J2EE Services Guide.

Using Deployment XML

To support Oracle RAC failover, you must configure orion-ejb-jar.xml file element message-driven-deployment attributes dequeue-retry-count and dequeue-retry-interval, as Example 18-4 shows.

The dequeue-retry-count attribute tells the container how many times to retry the database connection in case a failure happens; the default is 0 seconds.

The dequeue-retry-interval attribute tells the container how long to wait between retry attempts to accommodate for the time it takes for Oracle RAC database failover to complete; the default value is 60 seconds.

Example 18-4 orion-ejb-jar.xml For Oracle RAC Failover with an MDB

<message-driven-deployment name="MessageBeanTpc"
   connection-factory-location="java:comp/resource/cartojms1/TopicConnectionFactories/aqTcf"
   destination-location="java:comp/resource/cartojms1/Topics/topic1"
   subscription-name="MDBSUB"
   dequeue-retry-count=3
   dequeue-retry-interval=90/>
...

Using Java

To support Oracle RAC failover, you must configure a standalone OEMS JMS Database client running against an Oracle RAC database to retry if connection acquisition fails.

Oracle recommends that you use com.evermind.sql.DbUtil method oracleFatalError to determine if the connection object is invalid (see Example 18-5). If so, then reestablish the database connection, if necessary.

Example 18-5 Client Retrying After Connection Acquisition Failure

import com.evermind.sql.DbUtil;
...
getMessage(QueueSesssion session) {
    try {
        QueueReceiver rcvr = session.createReceiver(rcvrQueue);
        Message msgRec = rcvr.receive();
    }
    catch(Exception e ) {
        if (exc instanceof JMSException) {
            JMSException  jmsexc = (JMSException) exc;
            sql_ex = (SQLException)(jmsexc.getLinkedException());
            db_conn = oracle.jms.AQjmsSession)session.getDBConnection();
            if ((DbUtil.oracleFatalError(sql_ex, db_conn)) {
               // failover logic
            }
        }
    }
}