Instrumenting Human Workflow

Instrumenting Human Workflow

or BAM Enabling Oracle BPEL Workflow Services

I was just working on a proof of concept for a customer with my colleague Matt Wright when we had a need to monitor, through BAM, the progress of tasks in the human workflow service that ships with Oracle BPEL.  So we dove into JDeveloper and looked at the workflow editor to try and find where we could generate events for BAM to consume.  Shock, horror!  There don't seem to be any!
At this point Matt started thinking about how we could move some of the auto routing out of the human workflow and make it explicit in the surrounding BPEL process.

A Blind Alley

While Matt considered how he might rework his workflows I had a look at a button called 'Configure CallBacks ...' in the advanced section of the workflow editor.  This is described on the screen as 'Specify callback class on task status.'. 
Sounds interesting I thought, so I dived in and discovered that I could
use this button to register a Java callback class with the human workflow
task.  I could control when I wanted the callback to occur, the
following being the most interesting
  • On Assignment
  • On Update
  • On Completion
I was well down this route when a far superior solution presented itself.

Expanding Workflow

At this point one of the product team (thanks Bhagat I will always be grateful) came to our rescue and pointed out the 'Allow task and routing customization in BPEL callbacks' check box on the advanced section of the workflow editor.  This  causes the workflow task to callback into the initiating BPEL process on useful events such as
  • On Assignment
  • On Update
  • On Completion
This seemed to be exactly what we wanted so we clicked it!

So now we had the callbacks being sent but we still had to enable the BPEL process to properly receive and process them.  To do this I went into the diagram view of the BPEL editor and clicked on the human task in my process.  I then chose the advanced tab and clicked the 'Allow task and routing customizations in BPEL callbacks' check box to cause the BPEL editor to generate the code to handle the callbacks from the workflow task.

This caused the BPEL to be expanded to include event notification handling for the callbacks as shown below:
BPEL flow before callbacksBPEL flow after callbacks

With this in place I could now instrument the callbacks by adding BAM sensors to get events into BAM whenever a task was assigned, completed or updated, allowing me to track in real time how the process was developing.  Hopefully a future release of workflow services will let us embed the BAM sensors direct into the workflow.

In Conclusion

In this entry we have looked at how we can use the callback feature of human workflow to generate events into a BPEL process so that we can then trivially instrument those events using BAM  This extends the range of things we can monitor with BAM into the internal routing of tasks within the BPEL workflow service.  To enable this for an existing BPEL process with human workflow we do the following
  • Enable callbacks from human workflow by checking the "Allow task and routing customization in BPEL callbacks" box in the "Advanced Settings" section of the workflow editor.  This configures the Human Workflow service to send the callbacks.
  • Modify the BPEL generation to include handling code for the callbacks by checking the "Allow task and routing customization in BPEL callbacks" in the "Advanced" tab of the human task dialog on the BPEL diagram editor.  This must be done if human workflow is configured to send the callbacks otherwise you will get errors in the worklist application.
That just leaves the hard part, deciding which data we want to capture and monitor in BAM.


Hi Antony, This is a really neat approach of event handling in human workflow. I did atleast 3 POC(s) in FY07 where I used the standard java event handling mechanism as I did not know about this approach. Having read your blog, I couldn't stop but try this out. OnCompleted and OnTaskUpdated get called but OnAssigned branch never gets called. What might be the reason behind it. Have you also faced it?

Posted by Anand Verma on August 07, 2007 at 03:37 AM MDT #

Post a Comment:
Comments are closed for this entry.

Musings on Fusion Middleware and SOA Picture of Antony Antony works with customers across the US and Canada in implementing SOA and other Fusion Middleware solutions. Antony is the co-author of the SOA Suite 11g Developers Cookbook, the SOA Suite 11g Developers Guide and the SOA Suite Developers Guide.


« July 2016