Tuesday, September 11, 2007

Cancel workflow / human-task

Work with human work flow in Oracle SOA Suite is very powerful. Within Oracle BPEL you can create a human task for a particular user or user-group. But as these tasks are assigned to users, the BPEL process is waiting on result. Depending on the task configuration, you could assign time-outs and escalation paths.

From business perspective, you could have a rule that says; reject all open task for a particular user or group. So how do we approach this issue? Oracle Suite has a rich Java API to control the human work flow. In this case you could create a java program that collects information from the work flow engine to cancel the tasks. This java program could be a:
  • A java client.
  • A web application, using the java api.
  • Embedded Java in the BPEL process.
But a closer look in the human task call in the BPEL process, shows another solution. Apart of initiating a human task you could also call various other operations:

The advantage to use BPEL code, you do not need any (embedded) Java API calls to fulfill this function. In our case we could invoke the human work flow via the 'updateTaskOutcome' operation. The are a few restrictions. Before you could set the outcome of an task (REJECT, APPROVED, DENIED, etc.) you must known the TaskID for that particular task and the session token of the task. This information is available in the BPEL process that creates this task. You could store this information in a database table to make it available for the process that wants to set the outcome.

A question was asked, how to obtain the TaskID and the session Token. This is easy. When a human-task is created, after the invoke in the human-task scope, a result is send back to BPEL. In this result you can retrieve information on this task. In our case you could read the TaskId and the Token. Saving this data in a table or file, you can use it by other processes to update the outcome.

Post a Comment