What Happens When You Create a Parallel Flow

Using Parallel Flow in a BPEL Process 9-5

9.2.3 Synchronizing the Execution of Activities in a Flow Activity

You can synchronize the execution of activities within a flow activity to ensure that certain activities only execute after other activities have completed. For example, assume you have an invoke activity, verifyFlight, that is executed in parallel with other invoke activities verifyHotel, verifyCarRental, and scheduleFlight when the flow activity begins. However, scheduling a flight is necessary only after verifying that a flight is available. Therefore, you can add a link between the verifyFlight and scheduleFlight invoke activities. Links provide a level of dependency indicating that the activity that is the target of the link scheduleFlight is only executed if the activity that is the source of the link verifyFlight has completed. Example 9–2 provides details. The link name verifyFlight-To-scheduleFlight is assigned to the source verifyFlight and target scheduleFlight invoke activities. If the source verifyFlight completes execution, the target scheduleFlight is then executed. Example 9–2 Link Between Source and Target Activities flow ... links link name=verifyFlight-To-scheduleFlight links documentation Verify the availability of a flight, hotel, and rental car in parallel documentation invoke name=verifyFlight ... sources source linkName=verifyFlight-To-scheduleFlight sources invoke invoke name=verifyHotel ... invoke name=verifyCarRental ... invoke name=scheduleFlight ... targets target linkName=verifyFlight-To-scheduleFlight targets invoke flow Example 9–2 provides an example of link syntax in BPEL version 2.0. The link syntax between BPEL version 1.1 and BPEL version 2.0 is slightly different. ■ BPEL version 1.1 uses target and source. ■ BPEL version 2.0 uses targets or sources. Table 9–1 provides details. 9-6 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite

9.2.4 How to Create Synchronization Between Activities Within a Flow Activity

To create synchronization between activities within a flow activity: 1. Create a flow activity. For information, see Section 9.2.1, How to Create a Parallel Flow.

2. In the General tab of the Flow activity, click the Add icon.

3. Enter a name for the link, as shown in Figure 9–5 . Table 9–1 Links Syntax in BPEL Version 1.1 and BPEL Version 2.0 BPEL Version 1.1 Example BPEL Version 2.0 Example flow links link name=XtoY link name=CtoD links sequence name=X source linkName=XtoY invoke name=A ... invoke name=B ... sequence sequence nameY target linkName=XtoY receive name=C ... source linkName=CtoD receive invoke name=E ... sequence invoke partnerLink=D ... target linkName=CtoD invoke flow flow links link name=AtoB links assign name=B targets target linkName=AtoB targets copy fromconcatoutput.payload, Bfrom tooutput.payloadto copy assign assign name=A sources source linkName=AtoB sources copy fromconcatoutput.payload, Afrom tooutput.payloadto copy assign flow Using Parallel Flow in a BPEL Process 9-7 Figure 9–5 Link Name Creation

4. Click Apply, then OK.

5. Drag appropriate activities into the flow activity to define as the source with the

same link name as defined in Step 3. The value of the link name of the source and target must be the same as the link name declared in the flow activity. For this example, an assign activity named A is defined as the source in Figure 9–6 . Figure 9–6 Source Activity Note that each source activity can specify an optional Transition Condition as a safe guard for following the specified link. Click the row in this column to invoke the Browser icon for accessing the Expression Builder dialog for creating a condition. If the Transition Condition column is left blank, it is assumed to evaluate to true. 6. Define appropriate copy rules for the assign activity.