WS-BPEL 2.0 Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Understanding a parallel flow

To invoke services concurrently, we can use the <flow> construct. In the following example, the three <invoke> operations will perform concurrently:

<process ...>
  ...
  <sequence>
    <!-- Wait for the incoming request to start the process -->
    <receive ... />

    <!-- Invoke a set of related services, concurrently -->
 <flow>
      <invoke ... />
      <invoke ... />
      <invoke ... />
 </flow>
    ...
    <!-- Return the response -->
    <reply ... />
  </sequence>
</process>

We can also combine and nest the <sequence> and <flow> constructs that allow us to define several sequences that execute concurrently. In the following example, we have defined two sequences, one that consists of three invocations, and one with two invocations. Both sequences will execute concurrently:

<process ...>
  ...
 <sequence>
    <!-- Wait for the incoming request to start the process -->
    <receive ... />

    <!-- Invoke two sequences concurrently -->
 <flow>
      <!-- The three invokes below execute sequentially -->
 <sequence>
        <invoke ... />
        <invoke ... />
        <invoke ... />
 </sequence>
      <!-- The two invokes below execute sequentially -->
 <sequence>
        <invoke ... />
        <invoke ... />
 </sequence>
 </flow>
    ...
    <!-- Return the response -->
    <reply ... />
 </sequence>
</process>

We can use other activities as well within the <flow> activity to achieve parallel execution. With this, we have concluded our discussion on the parallel invocation.

Pop quiz – service invocation

Q1. Which activity is used to invoke services from BPEL processes?

  1. <receive>
  2. <invoke>
  3. <sequence>
  4. <flow>
  5. <process>
  6. <reply>

Q2. Which parameters do we need to specify for the <invoke> activity?

  1. endpointURL
  2. partnerLink
  3. operationName
  4. operation
  5. portType
  6. portTypeLink

Q3. In which file do we declare partner link types?

Q4. Which activity is used to execute service invocation and other BPEL activities in parallel?

  1. <receive>
  2. <invoke>
  3. <sequence>
  4. <flow>
  5. <process>
  6. <reply>