Spring Boot integration with a differnet database

Hi
I’m searching also how to separate flowable tables from my business database. I tried this bean
@Bean
EngineConfigurationConfigurer EngineConfigurationConfigurer(@Qualifier(“flowableDataSource”) DataSource dataSource) {
return engineConfiguration -> engineConfiguration.setDataSource(dataSource);
}
but what i noticed that it created the flowable tables and my business tables in the same database, so would you mind telling what I’m missing ?

Hey, here’s the solution that worked for me.

application.properties additions:

business.datasource.driver-class-name=org.postgresql.Driver
business.datasource.jdbc-url=jdbc:postgresql://192.168.0.1:5432/business
business.datasource.username=business
business.datasource.password=business
flowable.datasource.driver-class-name=org.postgresql.Driver
flowable.datasource.jdbc-url=jdbc:postgresql://192.168.0.2:5432/flowable
flowable.datasource.username=flowable
flowable.datasource.password=flowable

Datasource and transaction manager setup:

@Bean(name = "businessDataSource")
@Primary
@ConfigurationProperties(prefix = "business.datasource")
public DataSource primaryDataSource() {
  return DataSourceBuilder.create().build();
}

@Bean(name = "flowableDataSource")
@ConfigurationProperties(prefix = "flowable.datasource")
public DataSource secondaryDataSource() {
 return DataSourceBuilder.create().build();
}

@Bean(name = "flowableTransactionManager")
public PlatformTransactionManager transactionManager() {
DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
transactionManager.setDataSource(secondaryDataSource());
  return transactionManager;
}

Flowable configuration

@Autowired
@Qualifier("flowableDataSource")
private DataSource dataSource;

@Autowired
@Qualifier("flowableTransactionManager")
private PlatformTransactionManager transactionManager;

@Bean
public EngineConfigurationConfigurer<SpringAppEngineConfiguration> engineConfigurer() {
  return configuration -> {
    configuration.setDataSource(dataSource);
    configuration.setTransactionManager(transactionManager);
    configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);
  };
}
4 Likes

I changed db schema update to true and it worked. Thank you so much for your help.

Thanks , it work for me . :grinning: