My delegateExpression bean returns an instance of ReceiveTaskActivityBehavior, which upon execute(), does the following:
- creating an instance of Runnable and
- sending it to our job scheduler (in a different thread).
ActivitiBehavior returns from execute() after doing these two things, ergo it does not wait for the job scheduler to finish the execution, and it's 'function' is only to schedule an asynchronous job. We do it this way, because the service Tasks we execute tend to take very long time (half a hour lenght would not be exceptional).
At the end of its execution, the Runnable calls RuntimeService.signal(executionId, Map<String,String>) to return its variables.
How to signal an error from the Runnable to the RuntimeService?
It would be normally a BpmnError, but since the task is ran by the process manager (which runs in a different thread), it would not be received by the ExecutionService.
We use Activiti 220.127.116.11