Custom Search SOABYTE here

Monday, November 8, 2010

Setting Time-out for DBAdapter Operations

Setting Time-out for Pure SQL/Stored Procedures

For Pure SQL/Stored procedures simply set the adapter WSDL jca:operation property QueryTimeout.  QueryTimeout is a property of DBPureSQLInteractionSpec / DBStoredProcedureInteractionSpec respectively.  This is starting in

Setting Time-out for Selects

After you create your service open up <serviceName>_toplink_mappings.xml and search for timeout.  You should see something like:
               <opm:query name="<serviceName>Select" xsi:type="toplink:read-all-query">
Simply change timeout to the desired value in seconds before deploying your process.  Note that on running the DBAdapter wizard any value you set here will be overwritten, so you will need to set it again.

Setting Time-out for Insert/Merge/Update (Descriptor Ammendment)

Currently there is no toplink_mappings.xml (meta-data) support for setting a timeout for write queries.  For this reason you have to use a feature of TopLink called descriptor ammendment.  A piece of Java code that gets executed at runtime when the TopLink project is loaded.
There are three steps to this.  First is coding the class and compiling it.  Second is making it available on the server classpath.  Third is modifying toplink_mappings.xml to configure the java code to be injected at runtime.

1 Coding and Compiling:

In your BPEL project create a class like this:
package oracle.tip.adapter.db.plugin;

import oracle.toplink.descriptors.ClassDescriptor;

 * This class ammends the TopLink project to set a default query timeout for
 * all statement calls in this partnerlink.
 * <p>
 * To compile add the library 'TopLink' to your project.

public class AfterLoadClass
    public static void afterLoad(ClassDescriptor descriptor)
        /* time-out value is in seconds and will apply to all queries, unless specified elsewhere. */

2 Making Available at Runtime

To make the class available at runtime, there are two rough approaches.  One is to add the class file to system/classes, and add the system/classes (create wherever) directory to server.xml.
The common approach is to patch the DBAdapter with this ammendment method.
cd $J2EE_HOME/connectors/DbAdapter/DbAdapter 
jar uvf DBAdapter.jar -C /scratch/work/scratch1013/QueryTimeoutProcess/BPEL-INF/classes oracle/tip/adapter/db/plugin/AfterLoadClass.class
cd ..
jar uvf  DbAdapter.rar -C DbAdapter DBAdapter.jar

3 Adding Ammendment Method to toplink_mappings.xml

    You will finally need to edit your toplink_mappings.xml and add the lines:
    between the lines:
     Do this multiple times if you imported multiple tables.  Note that on running the DBAdapter wizard any value you set here will be overwritten, so you will need to set it again.


Post a Comment

Blogger Profile