cancel
Showing results for 
Search instead for 
Did you mean: 

Async job timeout

lossril
Champ in-the-making
Champ in-the-making
Hello,

I've got a problem. There is a Service Task which takes some 20 minutes to execute (some pretty heavy SQLs). When AsyncJobExecutor is enabled in engine.properties (in this case I'm using the default Explorer webapp), it doesn't finish the job and restarts it. I've googled it and found that I can change this timeout programmatically by AsyncExecutor.setAsyncJobLockTimeInMillis(). How should I create an instance of AsyncExecutor properly in order to configure the engine with it? Also, is there any way to configure Explorer webapp to change the timeout?
4 REPLIES 4

sankalpn
Champ in-the-making
Champ in-the-making
Are you using spring configuration? If yes, you can get autowired ProcessEngineConfiguration and call getJobExecutor() on it.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

20 mins is a long time. I would prefer to just trigger task to execute outside of the process engine and finish the process instance. When the task is finished, it could send message/signal start event to start new process and handle results.

Regards
Martin

lossril
Champ in-the-making
Champ in-the-making
Well, I've succeeded in configuring the timeout through ActivitiEngineConfiguration class:
<java>
AsyncExecutor asyncExecutor = new DefaultAsyncJobExecutor();
asyncExecutor.setAsyncJobLockTimeInMillis(20 * 60 * 1000);
asyncExecutor.setDefaultTimerJobAcquireWaitTimeInMillis(20 * 60 * 1000);
processEngineConfiguration.setAsyncExecutor(asyncExecutor);
</java>

Works fine. Martin, why would you advise against this practice? Will it affect engine in a negative way? Do you suppose to create some servlet, which will be accessible through REST API and return call results as signal variables, so service task will just send a REST request and won't wait for the response?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

the problem from my point of view is that async job execution starts transaction. This transaction is finished when the service work is done (20 mins). It does not make sense to keep transaction open for 20 mins.

Regards
Martin