Tuesday, August 30, 2011

Message wait and notification in OBPM

The exp file is under Avio-OBPM Training\Message Wait\

Parent/Child Notification using Send Message Activity

In task 1, this is sending notification from the child process.

Add a “Message wait” event, in its properties window

image

The first dropdown list is the name of the activity that invokes the subprocess. In this example, the process “SubProcess” invokes the subprocess.

The radio of “Waits for” indicates that it would be notified by a Child process.

image

create argument “customerStatusArg”

image

Add argument mapping

image

In the subprocess, put in the “Send Message” event

image

set the argument mapping

image

image

In the “Child Process before the Notification”, it already contains the code. Here it has an example about populating dropdown list at runtime.

input "Customer Status" : customerStatus in ["Active","Inactive","Pending"]
using title = "Enter customer status",
buttons = ["Ok", "Cancel"]
returning selectedButton = selection




External Notification



task 2, this is to send notification from another process (not child process)



Add a “Message Wait” event,



image



Select the “external” radio.



Add argument and its mapping on “Message Wait” event.



image



Double click the “Begin” activity in the “Process to Notify Externally” process. Note that a mapping has already been created for you. “id.id” is predefined variable.



image



This will display the id in column description on the screen.



image



In Process “Sender of Notification”, double click “Sender of Notification”. And put in this code. This is the code in PBL



instanceIdToNotify as String
selectedButton as String
customerStatus as String

// Associative array to pass with notification
params as Any[String]

input "Enter the instance id to notify" : instanceIdToNotify (textarea) ,
"Enter the customer’s status" : customerStatus
using title = "External Notification",
buttons = ["Ok", "Cancel"]
returning selectedButton = selection

params["customerStatusArg"] = customerStatus

// Pass in the id.id of the instance to notify and the
// name of the activity it is waiting in
send Notification
using instanceId = instanceIdToNotify,
activityName = "MessageWaitHitExternally",
argumentSetName = "In",
parameters = params


Here is the same function in java



String instanceIdToNotify;
String selectedButton;
String customerStatus;

// Associative array to pass with notification
Any[String] params;

input("Enter the instance id to notify" instanceIdToNotify (textarea),
"Enter the customer’s status" customerStatus, title : "External Notification",
buttons : { "Ok", "Cancel" }, out selection : selectedButton);

params["customerStatusArg"] = customerStatus;

// Pass in the id.id of the instance to notify and the
// name of the activity it is waiting in
Notification.send(instanceId : instanceIdToNotify, activityName : "MessageWaitHitExternally",
argumentSetName : "In", parameters : params);


When testing, copy the “id” from the description and paste it.



image





 



Notification with an interrupt



task 3, this task will be able to send notification to a process and interrupt it. For example, cancel an order.



 



image



Select “External” and “Allows interruptions”, the Message Wait activity is an orphan outside of the process flow. It has no transitions coming into it. It has a lightning bolt inside of it. The bolt indicates that it allows interruption in the process.



Create a Interactive activity



image



Put in this code



customerStatus = "Interrupted"

action = BACK


To test it



image



image





image



image





image



Click “After the interrupt”, because of the code “action=BACK”, it sends the instance back to where it came from in the process before it was interrupted.



image

No comments:

Post a Comment