Multi Tenant with Embedded Process Engine and local class and beans

I have multiple applications, each use Camunda as an embedded process engine, but all configured on same database.

As I have bunch of Delegates/Listeners in each of BPMNs (each local to its application), and there are also some Timer tasks (with listeners), I expect each deployment just takes jobs of its own tenant (otherwise it cannot find Delegate/Listener classes from other applications).

I couldn’t find a way to do this, and I analyzed Job.selectNextJobsToExecute query, and there is no tenant filter on it. So how can I force job executor to just pick jobs of a specific tenant?

Hello @pashazadeh ,

for this purpose, you can configure your job executor to be deployment-aware.

This can be done either in the bpm-platform.xml, the standalone.xml or the spring boot yml config.

The property is jobExecutorDeploymentAware .

Deployment-aware means that the job executor will only pick up jobs that are part of a process application which is currently deployed to the engine.

I hope this helps

Jonathan

Thanks for answer, but the problem is deployment ids, as they might change by deploying new BPMNs.

And there is a org.camunda.bpm.engine.spring.SpringTransactionsProcessEngineConfiguration#setDeploymentTenantId, what is its usage then?

Should I create a Spring job to register new deployments periodically?

Hello @pashazadeh ,

each deployment has an id. When creating a new deployment, it receives a new id.

Please do not confuse multi-engine setup with tenants.

Tenants are within the engine, while mulitple engines on the same database might use the same or no tenant.

The configuration might be helpful if you define a default tenant.

Why would you want to register new deployments on a regular basis? What do you want to achieve?

Why should the job executor not execute jobs from other tenants?

Jonathan

Well it is not a regular basis, but when I update a BPMN (a new version) then I must change the code of system using it to be aware of the new deployment. And deployment ids are different in development, test and production environment.

To achieve what I needed, I’ve added a Spring scheduled bean to find all deployments of a tenant, and register them in ManagementService, and solved my issue.

Thanks by the way.