Time for action – triggering a fault within the BPEL process
So far, we implemented two <scope>
activities that model the book ordering process. However, to trigger <compensationHandler>
of the <scope>
activities, we need to have either <catch>
, <catchAll>
, <compensationHandler>
, or <terminationHandler>
. We will use <catchAll>
, and inside this, we will trigger <compensationHandler>
. To trigger <catchAll>
, we need to throw an explicit fault after the execution of the two scopes. Next, we learn how to throw this fault.
Carry out the following steps:
- Add a
<sequence>
activity namedthrowFault
after the<scope>
activity namedinitiateCreditCardTransaction
. Then, drag-and-drop an<if>
activity within it and specify its condition, as shown in the following screenshot. This condition will check the content ofinputVariable
and check whether it contains thecompensate
value: - Add a
<throw>
activity inside it...