AnsweredAssumed Answered

AsyncExecutor job acquirement order

Question asked by mamuf on Mar 31, 2015
Latest reply on Apr 1, 2015 by trademak

I would like to be able to set preferred ordering of Activiti Jobs acquired for execution. Our team is implementing Activiti engine for performance processing of data transfers. For each transfer a new Activiti process instance is created which performs some pre- and post- tasks along the transfer itself. Almost every task in that process is a Java-based service task and almost all of them are executed with async=true, so the Job executor is quite crucial in our setup.

Transfers (= processes) are generated through the whole day in batches. There are tens of thousands of transfers through the day, but there are peak hours during which thousands of transfers need to be processed.

The problem is, when more than a few hundred Activiti processes are started in a short time (minutes), the way the Jobs are selected from DB leads to newer Jobs to jump the "queue", ie. older processes take more time than the new ones because their async Jobs have to wait for newer Jobs to execute.

Now, I have found that the class AcquireAsyncJobsDueCmd executes the "selectAsyncJobsDueToExecute" statement for Job entity, but there is no ORDER BY, so the ordering is solely on the DB itself.

Is it be possible to force the AsyncExecutor to select oldest Jobs first — ie. FIFO? Thanks.