AnsweredAssumed Answered

Asynchronous / Long Running Activities

Question asked by dstone_dalet_com on Mar 12, 2015
Latest reply on Mar 26, 2015 by boekhold
Hi,

We are developing a product which uses the Activiti Engine (5.17).  We have implemented a number of activities that execute long lived jobs within our system.  The prototype versions of these activities were implemented using a script or JavaDelegate based task which submits the job and blocks until the job is complete.  This works OK for demo purposes but is obviously not fit for production.

I understand the Activiti Engine supports log lived jobs (asynchronous) but I'm not clear on how these should be implemented.

We have identified at least 2 different approaches to this problem:

1. Use a BPMN ReceiveTask with an Activiti "start" listener:
- "start" listener submits the job;
- ReceiveTask is executed and goes into a wait state;
- job service signals Activiti engine when job is complete;
- Activiti engine signals / wakes the ReceiveTask and it completes;
- process continues…

1. Use a BPMN ServiceTask  with a TaskActivityBehaviour extended class:
- TaskActivityBehaviour execute() method is called and submits the job;
- TaskActivityBehaviour execute() exits and execution goes into a wait state;
- job service signals Activiti engine when job is complete;
- TaskActivityBehaviour signal() method is called.  Method calls leave();
- process continues…

Are either of these the official / preferred method?  Should we do it some other way?
Best regards,
Dan

Outcomes