Chapter 8. Dynamic Parallel Invocations

Until now we have seen how to do parallel activity execution with a <flow> activity. We also learned about the <while> and <repeatUntil> activities, which support for repetitive executions. Suppose the BPEL process needs to read 10 data entries from a database. The BPEL process should execute the same data retrieval command with a different index in each command. This is a repetitive task, so we can use <while> or <repeatUntil> to achieve it. However, this can be parallelized as well. Each data retrieval command is executed in a parallel manner than in a sequential repetitive manner. How can a BPEL process execute a set of repetitive tasks in parallel?

The <forEach> activity comes to the rescue. It lets us define repetitive tasks in sequential or in parallel. Let's see how it works.

In this chapter, we will cover the following topics:

  • Introducing dynamic parallel invocations
  • Adding dynamic parallel invocations to a BPEL process
  • Configuring the <invoke> activity within a <forEach> activity
  • Initializing the input variable within a <forEach> activity
  • Initializing a dynamic partner link within a <forEach> activity
  • Introducing a parallel <forEach> activity and its execution semantics

Introducing dynamic parallel invocations

In this section, we introduce a new sample named book querying process that reads a book name as input, searches it across all the bookstores (Bookstore A, Bookstore B, and Bookstore C), and returns the bookstores in which the book is available. The sample is as shown in the following screenshot:

Introducing dynamic parallel invocations

Creating the <forEach> activity

Let's move on to the creation of the <forEach> activity creation. Within the <forEach> activity, we use the <invoke> activity to send search requests. During the <invoke> creation process, the input and output variable creation also can be configured. First of all, let's create a new asynchronous BPEL 2.0 process named Book_Querying_Process. We illustrated creating an asynchronous BPEL process in Chapter 5, Interaction Patterns in BPEL.

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

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