Friday, August 08, 2008

Human Task Escaltion Settings

While using human task in BPEL, if particular task is not actioned with in a configured time period. we can configure to escalate that through E-mail, Work Item or Event. In event we can customize how we want to handle the escalation. The human tasks which are claimed, ready and subtask started can be configured to escalate.



We have done with event. I will explain how to escalate human task using event. Select any one of the escalation type and create a escalation. In the details tab configure the values you need

Excepted Task State, Escalate After (Time), Notification Type and others.


Escalate After is the time configurable when escalation is to triggered after creation of task, It can be mentioned or it can be dynamic. For dynamic configuration you should pass the time as input to the Human task and you can access like this

%htm.input.<interfacename>HTParamaters\<inputBO Variable
Name>\<Variable holding value>





For example the time values can be like

10 Seconds, 10 hours, 10 minutes


In the Notification Type select Event

Select any where in the Human Task Editor go to the properties tab in details section there will be input place holder for Event handler name, give the class name of the eventHandler.


Now create the class with the name given in the event Handler input box that class should implement NotificationEventHandlerPlugin. This class has a method named escalationNotification with parameters taskID and escalation. with taskid you can get the input values of HT and do the what ever your escalation implementation as designed

TKIID tkiid = task.getID();
String HT_EJB="local:ejb/com/ibm/task/api/HumanTaskManagerHome"
context = new javax.naming.InitialContext();
LocalHumanTaskManagerHome localTaskHome =
(LocalHumanTaskManagerHome)context.lookup();
LocalHumanTaskManager taskManager = localTaskHome.create(HT_EJB);
ClientObjectWrapper clientObjectWrapper =taskManager.getInputMessage(tkiid);
DataObject inputDO = (DataObject) clientObjectWrapper.getObject();




Afer completeion of coding of go the project resources view create a folder name services inside META-INF folder, create a file inside the folder with the name of com.ibm.task.spi.<EventHandlerClassName>NotificationEventHandlerPlugin. Inside the file in the first line type the fully classified name of the event handler.

Upto this is WID. Now from WPS perpective. After installing the application. Go the TaskContainer application, browse through the link Map RunAs roles to users. Here you will see a user can be configured to run the escalation. If there is mismatch between the user which you have configured in Human Task the escalation task will fail.

The better approach is to use groups while configuring Human Task, create a user assign that user to the particular group and use that user as the run as user.