Custom Search SOABYTE here

Monday, November 8, 2010

XA Configuration JMS Adapters

To make 2 invokes commit or rollback as a unit requires the following: both JMS Adapter invokes must be configured to participate in global transactions, both invokes must participate in the same global transaction, and the failure of either invoke must cause the global transaction to rollback.

1. Configuring JMS Adapter for Global Transaction participation 

  • Deployment descriptor (oc4j-ra.xml) changes:
Property 'connectionFactoryLocation' should  point to XA enabled connection factory. Also, the property 'isTransacted' should be set to false.
An example of oc4j-ra.xml when using AQJMS Provider is shown below:
        <connector-factory location=.......
                <config-property name="connectionFactoryLocation" value="java:comp/resource/ojmsdemo/XAQueueConnectionFactories/myQCF"/>
                <config-property name="isTransacted" value="false"/>
                <config-property name="username" value="jmsuser"/>
               <config-property name="password" value="jmsuser"/>
  • Configure separate connector factories (in oc4j-ra.xml) for inbound and outbound adapter interactions:
          For AQJMS provider it would imply using separate OJMS resource providers (defined J2EE_HOME/config/application.xml) for inbound, outbound JMS destinations (queues or topics),
          and Connection Factory  participating in the same global transaction.
  • Configure a new partnerlink property (BPEL) or endpoint property (ESB) called "cacheConnections" to false. If unspecified, then the default value of true will be used. (default in both 10.1.2 and 10.1.3).

2. Both Invokes in Same Global Transaction 

Once the invokes participate in global transactions, to commit/rollback as a unit they must be participating in the same global transaction.  In BPEL this requires understanding where are the transaction boundaries, at what points a checkpoint to write to the dehydration store commits the current global transaction and starts a new one.
 The 'transaction boundaries' in a BPEL process are:
  • before a receive activity (but not the initial one!)
  • before a wait activity (otherwise the engine could run into a tx timeout)
  • before an onMessage, or pick(extended onMessage) activity
  • when invoking a synchronous child BPEL process, unless the transaction participate property is set on the partnerlink.  Otherwise the parent process is broken into two transactions and the child process executes in its own transaction.

3. Failure Must Cause Rollback

The global transaction participate property is set in bpel.xml, so that when BPEL catches a fault from the DBAdapter invoke it will allow the fault to propogate up and cause a global rollback.

How do you configure transaction participation?

On a child process invoke, set transaction participate on the partnerlink:
         <partnerLinkBinding name="...">
            <property name="transaction">participate</property>
To set the global property, so that a failed invoke will cause the entire transaction to rollback:
<property name="transaction">participate</property>

Related Questions

How do I find out more about XA?

Please look at the JMS Adapter sample []

What is the reason for the following error 'CCI Local Transaction COMMIT failed' when using XA?  

When the property 'isTransacted' is set to true it would result in the above error. A Sample error is shown as below:
CCI Local Transaction COMMIT failed due to: ERRJMS_COMMIT_FAIL.
Unable to commit transaction.
Please examine the log file to determine the problem.
    at oracle.tip.adapter.jms.JmsCciLocalTransactionImpl.commit(
    at oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeRequestResponseOperation(
    at oracle.tip.adapter.fw.AdapterFrameworkListenerBase.deliveryServiceSend(
    at oracle.tip.adapter.fw.jca.AdapterFrameworkListenerImpl.performSingleActivation(
    at oracle.tip.adapter.fw.jca.AdapterFrameworkListenerImpl.onMessage(
    at oracle.tip.adapter.fw.jca.messageinflow.MessageEndpointImpl.onMessage(
    at oracle.tip.adapter.jms.inbound.JmsConsumer.doSend(
    at oracle.tip.adapter.jms.inbound.JmsConsumer.sendInboundMessage(
    at oracle.tip.adapter.jms.inbound.JmsConsumer.send(
Caused by: javax.jms.TransactionInProgressException: JMS-239: Illegal attempt to call commit method on a XASession.
    at oracle.jms.AQjmsError.throwTranInProgressEx(
    at oracle.jms.AQjmsXASession.commit(
    at oracle.tip.adapter.jms.JmsTransactionImpl.commit(
    at oracle.tip.adapter.jms.JmsCciLocalTransactionImpl.commit(
Make sure the property is set to false when running under Global (XA) Transaction Semantics.


Post a Comment

Blogger Profile