rss
SOATUBE
Oracle
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"/>
                ...
                ...
        </connector-factory>
  • 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>
         </partnerLinkBinding>
To set the global property, so that a failed invoke will cause the entire transaction to rollback:
</partnerLinkBindings>
<property name="transaction">participate</property>
</BPELProcess>

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:
ORABPEL-12101
ERRJMS_TRX_COMMIT.
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(JmsCciLocalTransactionImpl.java:94)
    at oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeRequestResponseOperation(WSIFOperation_JCA.java:514)
    ...
    .....
    oracle.tip.adapter.fw.AdapterFrameworkListenerBase.executeDeliveryServiceSend(AdapterFrameworkListenerBase.java:573)
    at oracle.tip.adapter.fw.AdapterFrameworkListenerBase.deliveryServiceSend(AdapterFrameworkListenerBase.java:629)
    at oracle.tip.adapter.fw.jca.AdapterFrameworkListenerImpl.performSingleActivation(AdapterFrameworkListenerImpl.java:966)
    at oracle.tip.adapter.fw.jca.AdapterFrameworkListenerImpl.onMessage(AdapterFrameworkListenerImpl.java:813)
    at oracle.tip.adapter.fw.jca.messageinflow.MessageEndpointImpl.onMessage(MessageEndpointImpl.java:293)
    at oracle.tip.adapter.jms.inbound.JmsConsumer.doSend(JmsConsumer.java:571)
    at oracle.tip.adapter.jms.inbound.JmsConsumer.sendInboundMessage(JmsConsumer.java:507)
    at oracle.tip.adapter.jms.inbound.JmsConsumer.send(JmsConsumer.java:353)
    at oracle.tip.adapter.jms.inbound.JmsConsumer.run(JmsConsumer.java:274)
    at oracle.tip.adapter.fw.jca.work.WorkerJob.go(WorkerJob.java:51)
    at oracle.tip.adapter.fw.common.ThreadPool.run(ThreadPool.java:272)
    at java.lang.Thread.run(Thread.java:595)
Caused by: javax.jms.TransactionInProgressException: JMS-239: Illegal attempt to call commit method on a XASession.
    at oracle.jms.AQjmsError.throwTranInProgressEx(AQjmsError.java:592)
    at oracle.jms.AQjmsXASession.commit(AQjmsXASession.java:147)
    at oracle.tip.adapter.jms.JmsTransactionImpl.commit(JmsTransactionImpl.java:90)
    at oracle.tip.adapter.jms.JmsCciLocalTransactionImpl.commit(JmsCciLocalTransactionImpl.java:89)
  
Make sure the property is set to false when running under Global (XA) Transaction Semantics.

0 comments:

Post a Comment

 
Blogger Profile