Question

I have a process flow made in jBPM, and I've already implemented persistence in it. The next step is to make the flow stop at a given process, and wait in a queue until an answer is given to it by an external entity, so the flow can continue normally from that process.

My research on the subject so far has mixed me up a bit with some concepts such as WorkItemHandler, intermediate catch event and External Event.

Can anyone elucidate me on what's the correct way to do this?

Was it helpful?

Solution

You are on the right track, you need to use an async workitemhandler in order to represent that behavior. Basically a Async WorkItemHandler will not automatically complete the WorkItem as soon as the executeWorkItem() method finish. When the external notification comes in you will need to use the workItem.getId() in order to complete it using the ksession.getWorkItemManager().complete(id, params) method.

Notice that you will need to keep somewhere in your application the work Item id that is pending to be completed, that depends on your situation and how you are storing data.

Hope it helps! Cheers

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top