Search code examples
jbpmactivitibpmnbusiness-process-management

Intermediate event or timer in BPM


I have 2 separate synchronous "service tasks" in BPMN2.0 diagram - "Action 1" and "Action 2".

After successful executing of "Action 1", an outside event is expected (some action outside the system managed by BPM engine). After the event occurance, "Action 2" should be executed immediately (again, synchronous service task).

The complicated part for me is how to define timeout for the event, meaning event is expected, but only for some time (e.g. 1 minute)... Afterward, some timeout error handling should be executed.

So Action 2 should be executed in range 0 to 60 seconds after Action 1, as soon as possible, or not at all.

Any idea how to achieve this without using asynchronous task (see second picture)?

I have some idea (third picture), but I'm not sure if it would work as expected...

The diagram will be executed in Activiti BPM engine...

Synchronous execution

Synchronous execution

Async excecution

Async excecution

Suggested solution

enter image description here


Solution

  • What you need between Action 1 and 2 is a 'receive task': see http://activiti.org/userguide/index.html#bpmnReceiveTask. The engine will not continue unless an API call is done (runtimeService.signal in v5, runtimeService.trigger in v6). Add a timer boundary event (as on the third picture), to make sure the process instanc