cancel
Showing results for 
Search instead for 
Did you mean: 

Jobs and long running tasks

krraghavan
Champ in-the-making
Champ in-the-making
I have a situation and it's quite likely that I don't properly understand how asynchronous tasks work.  Here's a brief description:

1. Our workflows include several long running tasks (order of hours) that are Java Service tasks.  These tasks make an asynchronous call to an external system and poll the server to figure out if the task was completed (based on a handle that is returned when the job is submitted).
2. If the workflow engine crashes during this long running polling task, I want to be able to just continue the polling task and pick up from the polling task.

Since everything that happens before the polling tasks effectively marks a transaction boundary for us we made the polling task Asynchronous in the hope that it would create an execution in the table which can be resumed when the workflow engine comes back up.  However, what's happening is that depending on our poll cycle, the job that is created for asynchronous tasks kicks in and the poll task gets invoked multiple times.

Are we doing this wrong?  What is the preferred/recommended way to do this for our use case.  Please let me know if more information is required.

Thx
Raghavan
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Raghavan,

Async behaviour description http://activiti.org/userguide/index.html#bpmnConcurrencyAndTransactions.

In your case I would you messages/signals instead of async (which is not meant to do this job). The scenario could be:
process triggers long running task (do not wait on the end of the task) and waits in the message/signal intermediate catching event on the response from the long running task. When long running task is finished, it sends the message/signal and process instance can continue in the process execution.

Regards
Martin