Search code examples
jbpmbusiness-process-managementbpmn

Terminate process instance in jBPM 6


There's similar issue at Terminate process at any step (jbpm)

Similarly, I'd like to implement the ability to terminate the process instance at any task (script task, user task, service task). I can try to add a gateway with an intermediate catch event for each single task in my workflow. But it seems inefficient and makes the bpm diagram cluttered.

In Oracle BPM, it's easy to have a Message Wait event and an automatic task where I can do this.action=ABORT.

Oracle BPM Terminate

Similarly in my jBPM process, an user would send a "terminate" command through an UI which would terminate the process. Before termination, however, the process will do some post processing (i.e.,: update db table or send an email to notify users of termination) which I'd like to perform inside a custom work item handler. An example of the workflow would like look this. I know that this doesn't conform to the bpm specification that an user task should have one incoming and one outgoing connection.

Example workflow with termination signal


Solution

  • I would recommend using an signal event sub-process that would listen for some 'terminate' signal and perform the termination script and then terminate the process instance. You can specify this once as a separate section in your diagram (basically remove the nodes you added and put a new event sub-process at the button with a signal event -> script -> terminate end event instead).