Multi instance setup using same DB but different tenant_id

Hi,

I will keep this question as short as possible. Consider the following setup:

  • Two OP-engine instances running different codebases. Lets call OP-instance 1 OP1 and the other OP2.
  • OP1 - pickup jobs from default tenant i.e. “”
  • OP2 - pickup jobs from tenant only (and only) from “foo”

I am using spring boot along with the flowable-starter, and by reading the documentation it seems like MultiSchemaMultiTenantProcessEngineConfiguration along with its ExecutorPerTenantAsyncExecutor seems like the correct solution. But whatever I do I cannot get this to work. Note that I have completely excluded the default ProcessEngineAutoConfiguration, before trying to configure the MultiSchemaMultiTenantProcessEngineConfiguration.

So to my question: is this setup even possible? My observations are as follows:

ExecutorPerTenantAsyncExecutor creates four runnables:
TenantAwareAcquireAsyncJobsDueRunnable - for aqquiring async jobs. Its name is dependent of the tenantId.
TenantAwareResetExpiredJobsRunnable - for resetting expiried jobs. Its name is dependent of the tenantId.
TenantAwareAcquireTimerJobsRunnable - for aqquiring timer jobs. Its name is not dependent of the tenantId (why not?).
TenantAwareExecuteAsyncRunnableFactory - for executing the jobs. for aqquiring timer jobs. Its name is not dependent of the tenantId (why not?).

When looking for these executors they do not consider the tenant_id when “picking up” jobs. Even though ACT_RU_JOBS contains tenant_id. I don’t understand the meaning at all for the ExecutorPerTenantAsyncExecutor. Whatever I do the async timer jobs, beloning to the default tenant “”, are being picked up and executed. Even though I have configured a specific tenantId for that instance.

Any help would be appreciated. The documentation does not cover this at all. The following is what I have come up with:

@Profile("!it")

@EnableAutoConfiguration(exclude={ProcessEngineAutoConfiguration.class})
@Configuration
public class ProcessEngineConfiguration {

@Value("${flowable.process.async.executor.current-tenant-id}")
String tenantId;

@Bean
public TenantAwareDataSource tenantAwareDatasource(SingleTentantInfoHolder tenantInfoHolder, DataSource dataSource) {
	TenantAwareDataSource tenantAwareDatasource = new TenantAwareDataSource(tenantInfoHolder);
	tenantAwareDatasource.addDataSource(tenantId, dataSource);
	return tenantAwareDatasource;
}

@Bean
public MultiSchemaMultiTenantProcessEngineConfiguration multiSchemaProcessEngineConfiguration(SingleTentantInfoHolder tenantInfoHolder, TenantAwareDataSource tenantAwareDatasource){
	MultiSchemaMultiTenantProcessEngineConfiguration processEngineConfiguration = new MultiSchemaMultiTenantProcessEngineConfiguration(tenantInfoHolder);
	processEngineConfiguration.setDatabaseType(MultiSchemaMultiTenantProcessEngineConfiguration.DATABASE_TYPE_POSTGRES);
	processEngineConfiguration.registerTenant(tenantId, tenantAwareDatasource);
	processEngineConfiguration.setAsyncExecutorActivate(true);
	processEngineConfiguration.setFallbackToDefaultTenant(false);
	processEngineConfiguration.setDisableEventRegistry(true);
	processEngineConfiguration.setDisableIdmEngine(true);
	return processEngineConfiguration;
}

@Bean
public ProcessEngine processEngine(MultiSchemaMultiTenantProcessEngineConfiguration multiSchemaProcessEngineConfiguration) {
	return multiSchemaProcessEngineConfiguration.buildProcessEngine();
}

@Bean
@ConditionalOnMissingBean
public TenantAutoDeploymentStrategy tenantAutoDeploymentStrategy() {
	return new TenantAutoDeploymentStrategy(tenantId);
}

@Bean
@ConditionalOnMissingBean
@ConfigurationProperties(prefix = "flowable.process.async.executor")
public SingleTentantInfoHolder tenantInfoHolder() {
	return new SingleTentantInfoHolder();
}

}

@henkar Have you solved it yet? Could you share your solution?