Please give me more detilas of how camunda supporte the multi tannacy of database isolation

Hello everyone.
I already read the document of how camunda supporte multi tannacy at camunda website.
There are many information talking how camunda supporte the multi tenancy via table/shcema isolation.
But there are too few information talking how supporte the multi tenancy via database isolation.


So I want to know is there have a interface that use to give the right datasource to the camunda at each request then the camunda use that datasource to connect the database to do something of that need to do.

The hibernate provided a interface like below

public class DataSourceBasedMultiTenantConnnectionProviderImpl extends AbstractDataSourceBasedMultiTenantConnectionProviderImpl {

    private static final Logger LOG = LoggerFactory.getLogger(DataSourceBasedMultiTenantConnnectionProviderImpl.class);

    @Autowired
    private TenantRepository tenantRepository;

    private Map<String, DataSource> dataSourceMtApp = new TreeMap<>();

    @Override
    protected DataSource selectAnyDataSource() {
        if (dataSourceMtApp.isEmpty()) {
            loadAllTenantDataSource("selectAnyDataSource");
        }
        return this.dataSourceMtApp.values().iterator().next();
    }

    @Override
    protected DataSource selectDataSource(String tenantIdentifier) {
        if (!this.dataSourceMtApp.containsKey(tenantIdentifier)) {
            loadAllTenantDataSource("selectDataSource");
        }
        return this.dataSourceMtApp.get(tenantIdentifier);
    }

The interface have two method only. The first return the default datasource to hibernate the second return the datasource of tenant and then hibernate use the datasource to connect the right database at each request.

So please give me more information of how camunda supporte the multi tannacy via database isolation.

Thanks you all.

Hi @himly,

as your are asking in the spring boot starter category I assume that this is your desired runtime.

You can’t use multi tenancy with database isolation in this scenario.

If you want to, just start a spring boot application for each tenant. Or switch to the shared process engine deployed on tomcat or wildfly. There you can configure multiple process engines connected to separate databases: https://docs.camunda.org/manual/7.10/user-guide/process-engine/multi-tenancy/#one-process-engine-per-tenant

Hope this helps, Ingo

Thank your reply. Although your answer not resolved my problem but your answer enlightened me.
Now I want to use multiple engines to resolve my promble. Thats mean each tenant has a process engine.

If you have the time to looking my this question it will help me so much.

Thank you. Please forgive my poor english.