A BPEL process may want to catch a rollback fault thrown by another BPEL process. This recipe shows how to do that.
composite.xml
containing the callee BPEL process (the BPEL process that throws a rollback
fault) and switch to the Source View tab.component
element corresponding to the callee BPEL process and verify that either:There is no bpel.config.transaction
property:
<component name="BPELProcess1" version="1.1">
<implementation.bpel src="BPELProcess1.bpel"/>
<!—No bpel.config.transaction property -->
</component>
Or the bpel.config.transaction
property is set to requiresNew
:
<component name="BPELProcess2" version="1.1"> <implementation.bpel src="BPELProcess2.bpel"/> <property name="bpel.config.transaction" many="false" type="xs:string">requiresNew</property> </component>
invoke
activity to the callee BPEL process:
The catch block is to be executed when a rollback fault is thrown in the callee BPEL process.
When a BPEL process throws a rollback
fault, it cannot be caught in the current transaction context. When the fault leaves the current transaction context, it is converted to a remoteFault
that can be caught in the caller BPEL process. It is necessary to make sure that the caller and callee are in separate transaction contexts; hence the need to check the value of the bpel.config.transaction
property is not set to required
.
When a BPEL process throws any fault that is not caught in the current transaction context, it causes the current transaction to be rolled back. If instead of throwing a fault a BPEL process returns a fault through a reply
activity, then the current transaction is not rolled back.