Catching rollback faults

A BPEL process may want to catch a rollback fault thrown by another BPEL process. This recipe shows how to do that.

Getting ready

Open the composites containing the caller BPEL process and the callee BPEL process.

How to do it...

  1. Open composite.xml containing the callee BPEL process (the BPEL process that throws a rollback fault) and switch to the Source View tab.
  2. Locate the 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>
  3. Open the caller BPEL process and add a catch block by selecting the triangular (How to do it...) icon on a scope containing the invoke activity to the callee BPEL process:
    How to do it...
  4. Double click on the Catch to bring up the Catch dialog.
  5. Click on the How to do it... icon in the Fault Name section of the dialog to launch the Fault Chooser dialog:
    How to do it...
  6. Select the remoteFault fault and click on OK:
    How to do it...
  7. Click on OK to apply the changes to the catch.

How it works...

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.68.159