Sunteți pe pagina 1din 11

Oracle BPM Suite 11g Sample Update task and message based correlation

Oracle BPM Suite 11g Update Task and Message Based Correlation

Contents
Oracle BPM Suite 11g Update Task and Message Based Correlation ........................... 1 1 Oracle BPM Suite 11g Update Task and Message Based Correlation ..................... 1 1.1 Concepts ............................................................................................................................... 1 1.1.1 1.1.2 1.1.3 1.2 1.2.1 1.2.2 1.3 1.3.1 1.3.2 1.4 Update Task ................................................................................................................... 1 BPMN Event Subprocess ........................................................................................... 1 Message Based Correlation ......................................................................................... 2 Scope ............................................................................................................................... 3 Whats Included ............................................................................................................ 3 Main Flow ...................................................................................................................... 3 Cancel Flow - Event SubProcess ............................................................................... 4

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

Understanding the Update Task sample ......................................................................... 3

Testing................................................................................................................................. 10

Oracle BPM Suite 11g Sample Update task and message based correlation

Oracle BPM Suite 11g Update Task and Message Based Correlation
Concepts
The Update Task Activity is a special Service Task that has been added to the BPMN palette in Oracle BPM Suite 11g R1 PS4 release. It is used for making changes to the states of active as well as outstanding Human workflow tasks. Using the Update Task you can suspend, withdraw, resume, escalate, reassign, suspend and resume the timers of outstanding Interactive tasks in 2-click operation.

1.1

1.1.1 Update Task

1.1.2 BPMN Event Subprocess


Special purpose inline or embedded subprocess used for events and exception handling and can listen to in-flight events and messages. It is visually denoted by dashed boundary in expanded form and starts with a Start Event of type either Message or Error or Signal or Timer. The event subprocess is active only when its scope (enclosing process or subprocess) is active. The Start Event of an Event Subprocess can be interrupting or non-interrupting. In the former, the main process flow is aborted and the process flows through the Event Subprocess. In the latter, the event subprocess is executed in parallel to the main process flow and is re-entrant.
Oracle BPM Suite 11g Update task and message based correlation 1

Oracle BPM Suite 11g Sample Update task and message based correlation

1.1.3 Message Based Correlation


Processes can interchange messages and have conversations. WS-Addressing or automatic correlation will suffice if one of the interacting parties creates a new instance of the other. In this case, the first time its not needed to determine which instance to route to, and once the first interaction has happened, the two instances can continue to converse using the WS-Addressing Conversation Id. However, if the Conversation is happening between 2 already created instances, then you need to have payload based correlation also known as Message based correlation to able to route the message correctly. The second use case for Message based correlation which is what this sample is showcasing is to handle in-flight messages (Message Start Event of an Event Subprocess).
Oracle BPM Suite 11g Update task and message based correlation 2

Oracle BPM Suite 11g Sample Update task and message based correlation

Prior to BPM 11g R1 PS4 FP release, BPM supported only automatic correlation via WS-Addressing headers. If message based correlation was needed, the approach was to delegate the correlation tasks to a BPEL process. Starting in 11.1.1.5FP, BPM now supports automatic and message based correlation. Starting in Oracle BPM Suite 11g R1 PS4FP, out of the box support for message based correlation is provided in addition to automatic correlation. Correlation Keys can be based on one or more Correlation Properties (message attributes) to form a unique key to locate the process instance. A wizard is provided to define Correlation Keys and they are set in the same way as Data Associations.

1.2

Sample Overview
This sample covers UpdateTask, Event Subprocess and Message based correlation. Note: This sample will work with Oracle BPM 11 g R1 PS4 FP release and above.

1.2.1 Scope

1.2.2 Whats Included


The sample Application has 1 Project:
1.

UpdateTask BPM Project

1.3

Understanding the Update Task sample


This is a very simple sample where a request comes in through a Message Start Event. The request has only a String payload.

1.3.1 Main Flow

This is followed by a Parallel Gateway consisting of Approvals1 and Approvals 2 process steps. The Approvals1 and Approvals2 both point to a common Human workflow task implementation. The task implementation is of type Single Approver and the assignee is set to the current swimlane role.

Oracle BPM Suite 11g Update task and message based correlation

Oracle BPM Suite 11g Sample Update task and message based correlation

The main flow ends after the approvals get completed.

1.3.2 Cancel Flow - Event SubProcess


In addition, there is a non-interrupting Message Start Event cancel Event of the Event Subprocess to be able to handle cancel requests.

Oracle BPM Suite 11g Update task and message based correlation

Oracle BPM Suite 11g Sample Update task and message based correlation

1.3.2.1 Configuring Message based Correlation Since, the cancel message is received when the process instance is in-flight, you need message based correlation to route the cancel message to the appropriate UpdateTask process instance. The basic steps for configuring message based correlation are:

Define Correlation Properties Define Correlation Keys using those Correlation Properties Associate Message Start Events with one or more Correlation Keys

Setting Correlation Property The first step is defining one or more properties that can be used to uniquely identify a process instance. These properties are referred to as Correlation Properties. In the simplest case a single Correlation Property can define the Correlation Key as in this sample. But often multiple Correlation Properties are combined into a Correlation Key. This is similar to how you might define a composite primary key in database design. If you right click on the Correlation Properties node youll get a dialog for creating properties.In this process the Correlation Property is just the input string.

Setting up Correlation Keys If you right click on the Correlation Keys node youll see the dialog for creating Correlation Keys. Note that Correlation Keys are built from existing Correlation Properties. A Correlation Property can be used in multiple Correlation Keys. When creating a Correlation Key, theres an icon where you can add new Correlation Properties; without having to close the dialog to return to the Correlation Properties dialog.

Oracle BPM Suite 11g Update task and message based correlation

Oracle BPM Suite 11g Sample Update task and message based correlation

Below is a screen shot that shows a complex Correlation Key made up of 3 Correlation Properties accountId, cardNumber, and requestDate. Those three properties are combined to create a Correlation Key named cKeyAcctCardReqDate, which uniquely identifies a process instance.

Initializing Correlation Keys Once youve defined the Correlation Key(s) for your process, the next step is to associate Correlation Keys with message events, and define whether the message Initiates or Uses the associated Correlation Key. Initializing a Correlation Key effectively sets the values for each property that uniquely identify the process instance. For any given process instance, a Correlation Key can only be initialized once. After that, the Correlation Key values can only be used to locate the process instance. This is configured by setting the Mode value to Initiates in the Correlations portion of the message event properties. To see how this is done in the credit card application: Right click on the Start message start event Youll see the Properties dialog, select the Implementation tab In the bottom portion of the Implementation tab youll see a series of links including one for Correlations. Select the Correlations link and youll see the Correlation Definition dialog.

The Correlation Definition dialog provides the ability to:


Oracle BPM Suite 11g Update task and message based correlation

Oracle BPM Suite 11g Sample Update task and message based correlation

Select the Correlation Key to use Select whether the mode is Initiates or Uses Map each of the Correlation Key properties to an element within the message. This creates an alias for each property that can be expressed using Xpath, a simple expression, or a literal value In this sample, the Correlation Key is set or Initialized from properties in the message that started the process (Start event). The message events that start the Cancel event subprocesses will be configured to Use that correlation key. Thats how a cancellation request can be correlated to the correct process instance.

Oracle BPM Suite 11g Update task and message based correlation

Oracle BPM Suite 11g Sample Update task and message based correlation

1.3.2.2 Suspend If a cancel request is received, then any pending approvals (if Approver1 and Approver2 process steps are active) are suspended. This is achieved through the UpdateTask Service activity. All active User Tasks are suspended in this case. You can also suspend a specific task or a set of tasks using taskIds.

1.3.2.3 Review step The Process Owner through the Review process step either chooses APPROVE or REJECT option. The outcome of the Review User task is mapped to the reviewOutcome Process Data Object.

Oracle BPM Suite 11g Update task and message based correlation

Oracle BPM Suite 11g Sample Update task and message based correlation

1.3.2.4 Resume If APPROVE is the outcome of the Review step, then the Approver1 and Approver2 process steps if suspended earlier are resumed and become active.

1.3.2.5 Withdraw If REJECT is the outcome of the Review step, then the Approver1 and Approver2 process steps if suspended earlier are withdrawn and the process completes.

Oracle BPM Suite 11g Update task and message based correlation

Oracle BPM Suite 11g Sample Update task and message based correlation

1.4

Testing
1. 2.

Go to EM and select the Test button for the BPMN process instance and select the request operation. Supply a string value for the input to initiate the process instance. Inside BPM Workspace, log in as jcooper and wfaulk. Claim the task but do not select any of the Actions. There is no UI Form associated with this project. Submit a purchase requisition request. Go to EM and and select the Test button for the BPMN process instance and select the request operation. Supply the same string value for the cancel input to send a cancellation request to the process instance started in step 1. Inside BPM Workspace, log in as jcooper and wfaulk. In the Task Panel, select the filter to show suspended tasks. You will see that the tasks which was in assigned state before is now is status suspend. Log in as process owner jstein and perform the Review step. Select action APPROVE. Log in as jcooper and wfaulk. You will see that the suspended tasks are now back to state assigned. Launch another instance and this time select REJECT for the Review step.

3.

4.

5. 6. 7.

Oracle BPM Suite 11g Update task and message based correlation

10

S-ar putea să vă placă și