Multi-tenancy with springboot

Hello,
I am new to Flowable and I have a springboot app in which I want to implement multi-tenancy where each tenant has its own db.
I have found some answers at the forum but some are old so I don’t know if they are still valid.
I’ve also checked flowable-engine/modules/flowable-engine/src/test/java/org/flowable/engine/test/cfg/multitenant/MultiTenantProcessEngineTest.java at main · flowable/flowable-engine · GitHub and flowable-engine/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/multitenant/MultiSchemaMultiTenantProcessEngineConfiguration.java at 9af12c0df51ef9cb29e1cd05a1fb015f1a80a021 · flowable/flowable-engine · GitHub
I am using flowable-spring-boot-starter dependency at my pom.xml and I saw here: Multi-Schema Process and Event Registry Engine Advice - #4 by chaserb that it’s not supported but it can be configured.
So, I have to add something like the following at my app?

@Bean
    public ProcessEngineConfiguration processEngineConfiguration() {

        TenantInfoHolder tenantInfoHolder = new DummyTenantInfoHolder();
        MultiSchemaMultiTenantProcessEngineConfiguration config = new MultiSchemaMultiTenantProcessEngineConfiguration(tenantInfoHolder);

        config.setDatabaseType(MultiSchemaMultiTenantProcessEngineConfiguration.DATABASE_TYPE_H2);
   
        config.setDatabaseSchemaUpdate(MultiSchemaMultiTenantProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        // Other configurations, e.g async executor, idm, event registry

        //todo: get tenants from tenant configuration repository

        // Set up the data source for each tenant
        config.registerTenant("tenant1",createDataSourceForTenant1());
        config.registerTenant("tenant2",createDataSourceForTenant2());
        return config;
    }

Is that enough? If the whole process engine configuration is overridden should I also configure other things?
Is there somewhere some documentation that I’m missing or some sample project?

Hey @desp.kaz,

You’ve created posts around the multi tenancy. Are the replies to Multitetancy with different database servers answering the questions you have here?

And indeed as you have seen from Multi-Schema Process and Event Registry Engine Advice - #4 by chaserb, we do not support the Multi Tenancy Process Engine Configuration with our Spring Boot starters. If you need something like that, then you’ll need to configure that on your own.

Cheers,
Filip

Hello @filiphr,
by configuration you mean something like the sample code that I have provided, right?

yes indeed. You’ll need to come up with a configuration like you’ve provided. I cannot say whether it is correct or not though and I’m not even sure that if you provide it like that it’ll work with the Spring Boot Starters.

Cheers,
Filip

1 Like