Friday 10 February 2012

Configuring Transaction in Composite

est Case: There are two table , one is Master and other is Child has primary/foreign key relationship. By a BPEL process we’ll insert the data into Master table and with other BPEL we’ll insert the data into Child in a same composite. But if any error occur while inserting the data into Child it will rollback all transactions in Master table as well.
Solution:Here I’ll use Dept and Emp table as Master and Child table.1st I’ll insert data into Dept and within same global transaction will insert data into Emp. After inserting the data into Emp I’ll throw rollback fault from BPEL and it will automatically rollback the insertion of Dept table data.Here is my composite,
image
The insertDeptBPEL is synchronous one,
image
The insertChildBPEL is synchronous one also,
image
Here in the throw activity,
image
Now the designing is complete, we need to define the transactional properties now in composite.xml like below,
<component name="insertDeptBPEL" version="1.1">
    <implementation.bpel src="insertDeptBPEL.bpel"/>
    <property name="bpel.config.transaction" many="false" type="xs:string">requiresNew</property>
    <property name="onewayDeliveryPolicy">sync</property>
  </component>
  <component name="insertChildBPEL" version="1.1">
    <implementation.bpel src="insertChildBPEL.bpel"/>
    <property name="bpel.config.transaction" many="false" type="xs:string">required</property>  </component>
Then deploy the run the composite , data will not be inserted in either of the table as it will execute rollback from the code.

No comments:

Post a Comment

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...