AnsweredAssumed Answered

Activiti Engine multi tenancy with separate schema

Question asked by manchandap on Aug 4, 2015
Respected Activiti Experts,

Currently the Activiti Engine supports multi tenancy by following the shared database design. In this design the data of all the tenants resides in the same database and tenant discriminator column is used to segregate the data for different tenants.

It is a good and simple design approach. However, if we have the use cases where we need to move a tenant's data from Production to Non Production setup, then complex database scripts would be required.

An alternate to above would be to support the 'separate schema' design where each tenant gets its own schema within the same database. The schema is switched at run time based on the tenant discriminator.

I analyzed the possibility to make Activiti Engine (v5.17) support separate schema. The Process Engine instance is created at server startup and the DataSource and SqlSessionFactory is created at that time. During it's life time the Process Engine uses the same DataSource Instance. So, even if the DataSource is multi tenant (how that can be done is database specific), the Process Engine won't switch to a different schema a runtime.

Any thoughts on this and any pointers towards enabling the Engine get a new instance of Data Source at run time.

Thanks and Regards
P Manchanda