Multi schema multi-tenancy with v5 embedded engine

Hi all,

we are currently trying to get the schema based tenant isolation (MultiSchemaMultiTenantProcessEngineConfiguration) running on flowable 6.4.1 in combination with the flowable v5 embedded engine. However, this seems to be impossible due to some exceptions during startup of the flowable engine (see below).

The buildProcessEngine method of V6 internally tries to initialize a v5 process engine within a Command. However, this Command requires a database transaction which cannot be created at that point in time as the TenantAwareDataSource does not have an entry for the empty tenant (which is the one that is set on engine startup).

We would require some guidance on how this can be fixed.

Best regards,

org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.flowable.common.engine.api.FlowableException: Could not find a dataSource for tenant “,”\tat org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(","\tat","\tat","\tat org.flowable.common.spring.SpringTransactionInterceptor.execute(","\tat org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(","\tat org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(","\tat org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(","\tat org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(","\tat org.flowable.engine.impl.cfg.multitenant.MultiSchemaMultiTenantProcessEngineConfiguration.buildProcessEngine(",

Looking at the code, it does look like combining multi-schema with v5 compatibility won’t work due to the chicken-or-egg problem of knowing which tenant to take (however the .getRawEngine() does need a command).

Some questions:

  1. How are you initializing the TenantInfoHolder? Wouldn’t it work by setting some tenant value before booting up the engine?

  2. Are you also using the multi-schema setup of the v5 engine?

  3. If so, which database are you using it in? Which async executor do you use?

Hi Joram,
yesterday we took a deeper look into the issue. We anticipated your first question and tried to register a dummy tenant on engine boot (our tenants are normally initiated lazy; we don´t know them at engine boot or they might join dynamically).

With this change, we passed at least the transaction issue. However, then we ran into the below exception which indicates that the DefaultProcessEngineFactory does not handle the multi-schema case. Providing a dedicated ProcessEngineFactory that does not work as well as the corresponding classes that implement the multi-schema case are not included in the flowable5-engine module.

To answer your last two questions: Yes, we are using the multi-schema setup already today in v5 and want to use it in v6 as well. We are using a proprietary database which does not cause a problem so far. Regarding the async executor, we use the ExecutorPerTenantAsyncExecutor.

Best regards,

“Caused by: org.activiti.engine.ActivitiException: Unsupported process engine configuration”,
“\tat org.flowable.compatibility.DefaultProcessEngineFactory.buildProcessEngine(”,
“\tat org.flowable.compatibility.DefaultFlowable5CompatibilityHandler.getProcessEngine(”,
“\tat org.flowable.compatibility.DefaultFlowable5CompatibilityHandler.getRawProcessEngine(”,
“\tat org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl$1.execute(”,