Hi team, hi all.
I need to use multitenancy mode “Multi-Engine / Shared Database”.
I need in different thread executors capacity. Because of that I create as many Process Engines as many tenants I have. For example 100 engines.
Each created Engine has own tenantId. Each Async Executor of each Process Engine has tenantId. Each Async Executor has own thread-pool configuration.
I create process definition and run process instance inside concrete Process Engine. All objects created by the Engine is assigned to an engine’s tenant.
But what I have with this approach:
- Each async job executor creates 3 threads: AcquireAsyncJobsDueRunnable, AcquireTimerJobsRunnable, ResetExpiredJobsRunnable.
- Each created AcquireAsyncJobsDueRunnable finds next jobs in DB to acquire and execute them.
- AcquireAsyncJobsDueRunnable calls AcquireJobsCmd that finds the jobs. But it does not use tenantId to find just own jobs, it gets any jobs for any tenants.
- The same happens with timers and reset jobs in AcquireTimerJobsCmd and FindExpiredJobsCmd.
But if different executors has different settings then it may be aquired and executed by wrong executor.
That is right?
I’m looking at ExecutorPerTenantAsyncExecutor.
Looks good at the point of “boolean executeAsyncJob(JobInfo job)” - it determines executor for current tenant. And looks like the job will be executed inside right executor.
But. It creates TenantAware-runnables that inside just sets current tenant. Yes, as I understand it will catch executor by tenant.
But the acquiring operation will find any job. For this job will be determined some executor for current tenant that does not equals job’s tenant.
That is right?
Is this a bug or is it expected? Where I’m wrong?
My target is that: I want to run process and execute jobs with a configured async executors.
Do I need create just one engine with many asyncExecutors (per tenant)?
Do I have to customize all runnables (like AcquireAsyncJobsDueRunnable) that will run custom commands to retrieve jobs belong the asyncExecutor’s tenant?