Вы находитесь на странице: 1из 11

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

Oracle BPM Suite 11g Multi-Instance


Subprocess Scoped Conversations

Contents
Oracle BPM Suite 11g Multi-Instance Subprocess Scoped Conversations ................. 1
0

Oracle BPM Suite 11g : Multi-Instance Scoped Conversations .................................. 1


0.1

Concepts ............................................................................................................................... 1
0.1.1

0.2

0.3

Configuration of Multi-Instance Marker .................................................................. 1

Sample Overview ................................................................................................................ 3


0.2.1

Scope ............................................................................................................................... 3

0.2.2

Whats Included ............................................................................................................ 3

Understanding the MultiInstance_ScopedConversation sample ................................ 3


1.1.1

Context ........................................................................................................................... 3

1.1.2

Overview ........................................................................................................................ 3

0.3.1

FulfillOrderItem Asynchronous BPMN Process .................................................... 4

0.3.2

ScopedConversation main BPMN process........................................................... 5

1.1.3

Testing the process ..................................................................................................... 10

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

0.1

Oracle BPM Suite 11g : Multi-Instance


Scoped Conversations
Concepts
In BPMN 2.0, you can specify loop characteristics to execute an activity multiple times. These loop
characteristics are visually depicted through a special Marker. The Multi-instance is a type of Loop
characteristic where a certain Activity can be executed multiple times in a parallel or sequential
fashion. In Oracle BPM Suite 11g, the Multi-Instance marker can be set only for an embedded
subprocess. It is used for creating For-loops and For-each-loops for iterating through Arrays. In the
BPMN model, a multi-instance activity (for or for-each loop) is indicated by a multi-instance marker
(three small parallel vertical bars horizontal for sequential and vertical for parallel) overlaid on the
subprocess activity. Please refer to the Oracle BPM 11g User Guide for more details.
http://download.oracle.com/docs/cd/E21764_01/doc.1111/e15176/cont_proc_flow_bpmpd.htm
#CHDFIFGE

0.1.1 Configuration of Multi-Instance Marker


Right click on the subprocess and select the Properties tab. Go to the Loop Characteristics tab. Select
MultiInstance option.

Mode - This determines whether you want the subprocess instances to be executed in Serial or Parallel
fashion.

Creation Type This indicates whether you are iterating through an Array or not.

Collection - This indicates that you wish to iterate through the elements of an Array and the number of
iterations depends on the Array size. The Multi-instance in this case is used to create for-each loop. Selecting
this option shows Loop Data Input and Loop Data Output. The former stands for the Array data type that
is passed as input to the subprocess and the latter the Array data type that is produced as a result of execution
of this subprocess. You can use XPATH Expressions to assign the values for these Arrays. The number of
times the subprocess is executed is determined by the size of the Array.

Oracle BPM Suite 11g MultiInstance Subprocess Scoped Conversation

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

Cardinality - If the input is not an Array, you will have to select Cardinality and specify the number of times
that you wish to execute this subprocess in the Loop Cardinality section. This creates a for-loop. In the
screen shot below, the Loop Cardinality is determined by an integer Process Data Object.

Completion Condition - You can specify a condition to terminate the subprocess instances
abruptly and come out of the subprocess scope. The BPM Service Engine computes this condition
every time a token completes the subprocess.

There are 5 pre-defined variables available for the Multi-Instance marker.

loopCounter sequence number of the iteration

numberOfInstances, numberOfActiveInstances, numberOfCompletedInstances,


numberOfTerminatedInstances as name indicates total number of instances, number
of instances currently active, number of instances that have completed already, and number
of instances that have been terminated.

Oracle BPM Suite 11g MultiInstance Subprocess Scoped Conversation

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

You can use these in the XPATH expression to specify Loop Cardinality and Completion Conditions.

0.2

Sample Overview

0.2.1 Scope
This sample shows creation of Scoped Conversations for correlating multiple asynchronous conversations
happening inside a multi-instance embedded subprocess.
Note: This sample will work with Oracle BPM 11 g R1 PS4 FP release and above.

0.2.2 Whats Included


The sample Application has 1 Project:
1.

0.3

MultiInstance_ScopedConversation BPM Project that highlights creation of Scoped


Conversations for correlating multiple asynchronous conversations happening inside a
multi-instance embedded subprocess.

Understanding the MultiInstance_ScopedConversation sample

1.1.1 Context
Scoped Conversations are used when there are multiple asynchronous conversations happening
within the multi-instance subprocess scope.

1.1.2 Overview
This is a very simple example where a list of Order Items are fulfilled such as in the previous case
but instead of using a User Task to fulfill the Order Items, we do an asynchronous invocation to
another BPMN process. The ScopedConversation is the main process and it invokes another
asynchronous BPMN process FulfillOrderItem from inside a multi-instance subprocess for
fulfilling Order Items.

Oracle BPM Suite 11g MultiInstance Subprocess Scoped Conversation

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

0.3.1 FulfillOrderItem Asynchronous BPMN Process


The BPMN Process has a service interface when it has a Message Start Event. In this case, the
BPMN process receives a request and returns the response in an asynchronous manner.

The configuration of the request-Message Start Event and the return Message End Event is
captured in the screen shots below. The configuration of the Message Start Event is the same
irrespective of whether the response returned in synchronous or asynchronous. You can define a
new interface operation and arguments or you can use an existing interface. An existing interface is
usually used when you have an inbound Adapter Service sending a message that in turn creates a
new process instance. In this case, we define a new interface. You can use the default conversation
in this case. The request argument is of type OrderItem.

Oracle BPM Suite 11g MultiInstance Subprocess Scoped Conversation

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

The configuration of the return - Message End Event is shown in the picture below. The
Asynchronous option is chosen. The argument is of type OrderItem and the callback Operation
name is return.

0.3.2 ScopedConversation main BPMN process


0.3.2.1 Receive Order Request
The process is instantiated upon arrival of Order Request and uses a Message Start Event to receive
the Order data. The incoming Order is mapped to an order - Process Data Object in the receive
order request Message Start Event.

Oracle BPM Suite 11g MultiInstance Subprocess Scoped Conversation

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

0.3.2.2

Process Order

The Process Order is a parallel multi-instance embedded subprocess that iterates through the list of
Order Items and the Clerk role fulfills it through the FulfillOrderItem User Task. The
subprocess is aborted if the Clerk is not able to fulfill an Order Item. The Process Order multiinstance subprocess is configured very similar to the Process Order step (1.4.4) in the previous
sample. The Mode is set to Parallel, the Creation Type to Collection. The Loop Data Input is
set to the Order Item array element of the order Process Data object using the XPATH
Expression before the multi-instance subprocess execution starts. The Loop Data Output is copied
back to the order Process Data object after the multi-instance subprocess ends.

Oracle BPM Suite 11g MultiInstance Subprocess Scoped Conversation

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

The order item fulfill request Send Task invokes the FulfillOrderItem - async BPMN
process and the order item fulfill response Receive Task receives the asynchronous response.
Since the pair of Send Task and Receive Task can be executed multiple times and there can be
multiple asynchronous conversations, a scoped conversation local to the embedded subprocess is
required. Further since the Send Task initiates the FulfillOrderItem - async BPMN process the
run-time engine can use the WS-Addressing based correlation and does not require Message-based
correlation sets.
0.3.2.3
1.

Creating Scoped Conversation

Select ScopedConversation BPMN Process node. Open up Structure Pane (View


Structure Pane). Go to Activities and select the multi-instance subprocess node. Open the
multi-instance subprocess node and right-click on Conversations folder and select New option
to create a conversation within the context of subprocess.

Oracle BPM Suite 11g MultiInstance Subprocess Scoped Conversation

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

2.

Provide a meaningful name for the Conversation (fulfillOrderScopedConversation). Choose the


FulfillOrderItem BPMN process for the Process field. Choose the conversation defined
within this asynchronous process for completing the asynchronous process request-response
pattern.

Oracle BPM Suite 11g MultiInstance Subprocess Scoped Conversation

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

0.3.2.4

Configuring Send and Receive Tasks

The order item fulfill request Send Task invokes the FulfillOrderItem BPMN Process. It
creates a new instance of the FulfillOrderItem BPMN process. The configuration of this Send
Task is shown in the screen shot below. Note that the conversation is set to the Scoped
Conversation we created in the previous section. The target node that receives this message is the
request-Message Start Event of the FulfillOrderItem BPMN Process.

The InputDataItem handle to the element of the LoopDataInput Array passed as input to the
multi-instance subprocess is mapped to the input argument for the Send Task as shown in the figure
below:

Oracle BPM Suite 11g MultiInstance Subprocess Scoped Conversation

Oracle BPM Suite 11g Sample MultiInstance Subprocess Scoped Conversation

The order item fulfill response Receive Task waits for the response from the
FulfillOrderItem BPMN Process. The target node that sends this message is the return-Message
End Event of the FulfillOrderItem BPMN Process. The configuration of this Receive Task is
shown in the screen shot below. Note that the conversation is set to the Scoped Conversation we
created in the previous section.

The output argument of the order item fulfill response - Receive Task is mapped back to
OutputDataItem. The OutputDataItem in turn is added to LoopDataOutput Array, the output
of the multi-instance subprocess.

1.1.3 Testing the process


1.

Go to Oracle Enterprise Manager (Oracle EM) and use the Test option to supply input values for
triggering the process instance. Type in values for the Order and Order Items.

2.

Then log in as Clerk role (jcooper/welcome1) in to Oracle BPM Workspace. Execute the Fulfill
Order Item tasks. The Clerk role is mapped to the Loan Agent LDAP group.

Oracle BPM Suite 11g MultiInstance Subprocess Scoped Conversation

10

Вам также может понравиться