cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-tenant Multi-schema in Spring Boot

jlalwani
Champ in-the-making
Champ in-the-making
I understand how the Activiti Process Engine is configured in Spring Boot. The SpringProcessEngineConfiguration extends ProcessEngineConfigurationImpl to provide the barebones configuration for Spring. Then you have various classes that extend AbstractProcessEngineAutoConfiguration that modify the SpringProcessEngineConfiguration to inject various beans into the configuration.

I read the documentation about how MultiTenant MultiSchemaMultiTenantProcessEngineConfiguration can be used to setup Activiti to use Multiple schema.

However, I don't understand how to do multi-schema in Spring Boot

Should I implement a MultiSchemaMultiTenantProcessEngineAutoConfiguration that extends AbstractProcessEngineAutoConfiguration and modifies the SpringProcessEngineConfiguration?  Perhaps it can be conditional on a bean of type TenantInfoHolder. Is there a similar AutoConfiguration in Activiti already that I can use?
2 REPLIES 2

jlalwani
Champ in-the-making
Champ in-the-making
Will this work?


@Configuration
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
@ConditionalOnBean(TenantInfoHolder.class)
public class MultiTenantMultiSchemaConfiguration {

@Bean
public DataSource dataSource(TenantInfoHolder tenantInfoHolder) {
  return new TenantAwareDataSource(tenantInfoHolder);
}

@Bean
public ProcessEngineConfigurationConfigurer multiTenantProcessingEngineConfigurer() {
  return new ProcessEngineConfigurationConfigurer() {
  
   @Override
   public void configure(SpringProcessEngineConfiguration config) {

    config.setIdGenerator(new StrongUuidGenerator());
   
   }
  };
}
}

nedumarans
Champ in-the-making
Champ in-the-making
Hi jlalwani,
i am also trying to set up acitivit with multitenant support. we would like to add different tenants at runtime. could could you please share some details on how to do that?