AnsweredAssumed Answered

multiple engines on single database - tenant question

Question asked by btomas on Nov 4, 2015
Latest reply on Nov 6, 2015 by btomas
Activiti engine A and engine B  (v.5.17)  are running on single database. To distinguish data content per engine tenancy is used - A has tenantId=tenant_A and B has tenantId=tenant_B. The situation similar to  Shared Database Multi-tenancy but here i've got separate applications running Activiti engine on its own sharing the same database.

When deploying definitions with tenantId set on separate applications (A and B ) everything works as expected - the tenantId is set automatically by Activiti engine in all entities required.
When querying for specific BPM processing data per A or B engine - i've included MyBatis org.apache.ibatis.executor.parameter.ParameterHandler interceptor which does its work for queries that use parameter objects of type java.util.Map or org.activiti.engine.query.Query where i can set specific tenantId value (tenant_A or tenant_B).

There is another story with async job executor. When creating jobs the tenantId values are stored into the act_ru_job table. But when acquiring jobs the tenantId is not taken into account.  i.e. JobEntityManager#findNextJobsToExecute executes query defined in job.xml named selectNextJobsToExecute which uses org.activiti.engine.impl.db.ListQueryParameterObject to pass parameters to the query (Date value) and not option for tenantId here.

Questions for this particular situation:
* how tenancy could be applied when acquiring for async jobs?
* is there any other way without using MyBatis interceptor plugins to apply BPM related data querying per tenantId on specific Activiti engine (engine A accesses only tenant_A, engine B queries only tenant_B on single DB )? One solution - use APIs which accept tenantId, but altering all my existing code with such changes doesn't look optimum.