Wednesday, March 9, 2011

Correlation with BPM 11g - cancelling a running instance

Scenario:

My esteemed colleague Angelo and I got this example together...

So what did we do?

We thought up the following simple scenario -
An order is passed on to a Salesperson for approval.
However, the customer can cancel the order while it is in flight.

So essentially we need to cancel a running BPM process based on an event -
So while our BPM process is doing it's thing, we also want to "listen" for any relevant "cancel" messages.




Steps

So what did we do?

We created a simple BPM app that included a User task to approve the order.
The BPM app will also start an instance of the listening BPEL process.



The BPM app will also contain an event handler that listens for a cancellation message from BPEL.

The simple BPEL process that will listen for cancellations -



We amended the BPEL wsdl to define the "cancelMsg" type and also included 2 new operations for the cancel - 1. to "receive the cancel", the other to do the cancel callback.

We created a correlation set on the Receive activity.
This is also leveraged by the OnMessage, which captures the cancellation and does the required callback.

Full doc and JDev project at -

https://docs.google.com/document/d/1tIYeEZM1kBmf2piGaeE5U0-59nGyQKaBand5kET-wUg/edit?hl=en&authkey=CJrT2pYK

and

https://docs.google.com/leaf?id=0B7YrnfO7h717ZDNjYTZmYWUtMDAxMy00MDIxLWExOGYtMWY0YzI5MWQxMzVi&hl=en&authkey=CIaZwMQL

No comments: