Monday, December 29, 2008

Dealing Transaction time-out(s) in Oracle BPEL & ESB processes

This post would cover the various transaction timeout properties & configurations of Oracle BPEL/ESB projects that can be of great help mitigating timeout issues during runtime arising due to several performance issues.

We had a synchronous BPEL process which would calculate, extract and generate generic XML content for use by other child BPEL processes, which were designated for various operations. The synchronous BPEL process would be called by main BPEL process which will manage the entire workflow. We had no issues in this process until the XML content generated by the synchronous process was fast & within the transaction time-out limits.

For transactions involving complex logic calculations & huge data extractions, the synchronous BPEL process took plenty of time to respond which resulted in transaction time-outs and the BPEL processes never proceeded to completeness.


To overcome this issue, we increased the transaction time-out parameters which can be configured in the Oracle SOA suite. Please note that the following settings are applicable for Oracle SOA suite 10.1.3.3 advanced installation.....
Config 1:
While introducing receive activity in a BPEL process anticipating a response from an Asynchronous BPEL process after an invoke, if the transaction times out; configure the following setting in the BPEL console which will increase the time-out duration.

This is the maximum time the process receiver will wait for a result before returning. Results from asynchronous BPEL processes are retrieved synchronously via a receiver that will wait for a result from the container.
  • Login to BPEL Console
  • Click on Manage BPEL Domain
  • Update the syncMaxWaitTime property to an increased value (Default is 45 sec) depending on the requirement
Config 2:
Modify the transaction-timeout property in the orion-ejb-jar.xml file available under the following location;
$SOA_Home\j2ee\oc4j_soa\application-deployments\orabpel\ejb_ob_engine\orion-ejb-jar.xml

There will be several session beans available in this config file - all of which should be configured with the same value for the transaction-timeout.
Config 3:

Modify the transaction-timeout property in the transaction-manager.xml file available under the following location;
$SOA_Home\j2ee\oc4j_soa\config\transaction-manager.xml

Please note that this timeout value should be greater than the values configured in Config 1 & 2. In essence this value should be larger than syncMaxWaitTime & transaction-timeout configured in orion-ejb-jar.xml file [Config 2].

Config 4:
While using Oracle Enterprise Service Bus (ESB), there can be transcation timeouts while transacting with other BPEL processes or during deployment of ESB projects via Oracle JDeveloper. For the former, Config 3 would suffice & for the latter, configure the xa_timeout parameter in esb_config.ini located in SOA suite at the following location;
$SOA_Home\integration\esb\esb_config.ini

Note that whenever an ESB initiates a transaction, timeout specified in the esb_config.ini will take precedence.
The above specs are gathered from the following resources;http://download.oracle.com/docs/cd/B31018_01/relnotes.1013/relnotes/esb.htm
http://download-west.oracle.com/docs/cd/B31017_01/integrate.1013/b28981/app_trblshoot.htm#sthref3957

Wednesday, December 24, 2008

Storing CLOB data in DB - Oracle BPEL

While working at the clients' place an year ago, being newly exposed to Oracle SOA & BPEL, we had a requirement to store large objects which were purely XML content in database tables. Hence, I created a column in the oracle database of CLOB datatype which can fit data upto 4GB and a DB Adapter in my BPEL process which will execute a query to insert data into the database column with CLOB datatype. So far so good.

This seemed to work fine for quite some time until the data was not more than 32766 bytes, which triggered my mind that there ought to be some issue with the Oracle SOA settings, as I was able to insert very large payloads (Obviously more than 32766 bytes) using the same sql query executed via SQL developer. The Oracle BPEL PM also threw the following exception when the BPEL process tried to invoke the DB adapter for large payloads;

java.sql.SQLException: setString can only process strings of less than 32766 chararacters

Internal Exception: java.sql.SQLException: setString can only process strings of less than 32766 chararacters

Error Code: 17157 when trying to insert record in clob type of size more then 32766 characters

After googling around for solutions, finally found the following solution (couldn't recall the thankful resource) which needs to be configured in the Oracle SOA suite for the CLOB data insertion.

With Oracle SOA Suite 10.1.3.3 advanced installation, I tried the following settings which resolved the issue;
Step 1:
Add/Append the following properties under the following file: $Oracle_Home\j2ee\oc4j_soa\connectors\DbAdapter\META-INF\ra.xml

<config-property>
<config-property-name>usesStreamsForBinding</config-property-name>
<config-property-type>java.lang.Boolean</config-property-type>
<config-property-value>true</config-property-value>
</config-property>

<config-property>
<config-property-name>usesStringBinding</config-property-name>
<config-property-type>java.lang.Boolean</config-property-type>
<config-property-value>true</config-property-value>
</config-property>


Step 2:
Configure the above properties in the connector-factory of the DB Adapter and ensure that "usesStreamsForBinding" and "usesStringBinding" are set to true;
$Oracle_Home\j2ee\oc4j_soa\application-deployments\default\DbAdapter\oc4j-ra.xml


<connector-factory location="eis/DB/DBConnection" name="Database Adapter">
<config-property value="jdbc/DBConnection" name="xADataSourceName">
<config-property value="" name="dataSourceName">
<config-property value="oracle.toplink.platform.database.Oracle9Platform" name="platformClassName">
<config-property value="true" name="usesNativeSequencing">
<config-property value="50" name="sequencePreallocationSize">
<config-property value="false" name="defaultNChar">
<config-property value="true" name="usesBatchWriting">
<config-property value="true" name="usesStreamsForBinding">
<config-property value="true" name="usesStringBinding">
<connection-pooling use="none"></connection-pooling>
<security-config use="none"></security-config>
</connector-factory>


Step 3:
Restart Oracle SOA Suite for all configurations to take effect and the BPEL process should work fine even with very large payloads.

Meet you in my next post with a possible solution for a new SOA challenge.....