Search code examples
springspring-bootactiviti

Activiti: Only run timer jobs associated with a specific process definition ID


I have two services running an activiti engine, each deploy a different process definition. processX is deployed by serviceX and processY is deployed by serviceY. processX and processY both have timer events that call a service method in serviceX and serviceY respectively.

I am running into an issue where the job for processX gets picked up by serviceY and the job for processY gets picked up by serviceX.

As per https://www.activiti.org/userguide/#async_executor_design this is expected behavior. All running instances of the activiti engine pointing to the same schema poll the job table and execute whatever is on top of the stack, regardless of process definition ID.

Is there any way to specify in the activiti configuration that only jobs associated with a specific process definition ID should be executed by a given instance of the engine?


Solution

  • It seems like this is not possible

    Activiti's architecture is built in such a manner that EVERY app sharing an Activiti DB and running an instance of the activiti engine should be able to execute ANY job stored in the activiti database

    If you have different apps, only capable of executing specific jobs, they should be backed by DIFERENT Activiti DBs

    Kinda of seems like a design oversight to me, but then again maybe I am abusing the arch