hi, here is my testing code:
@Transactional(rollbackFor = RuntimeException.class)
public void testTransaction(String taskId) {
tenantInfoHolder.setCurrentTenantId(“abe”);
taskService.complete(taskId);
tenantInfoHolder.clearCurrentTenantId();
throw new RuntimeException(“test transaction when fail”);
}
I wonder why task do not rollback when use MultiSchemaMultiTenantProcessEngineConfiguration , but SpringProcessEngineConfiguration can be work well, anyone any ideas?
below is my config:
@Bean
public TenantAwareDataSource tenantAwareDatasource(TenantInfoHolder tenantInfoHolder) {
TenantAwareDataSource tenantAwareDatasource = new TenantAwareDataSource(tenantInfoHolder);
return tenantAwareDatasource;
}
@Bean
@ConditionalOnClass(TenantAwareDataSource.class)
public MultiSchemaMultiTenantProcessEngineConfiguration multiSchemaProcessEngineConfiguration(
ApplicationContext applicationContext,
TenantAwareDataSource tenantAwareDataSource, PlatformTransactionManager transactionManager){
MultiSchemaMultiTenantProcessEngineConfiguration cfg = new MultiSchemaMultiTenantProcessEngineConfiguration(tenantInfoHolder);
cfg.setDatabaseType(MultiSchemaMultiTenantProcessEngineConfiguration.DATABASE_TYPE_MYSQL);
cfg.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
cfg.setAsyncExecutorActivate(true);
cfg.setFallbackToDefaultTenant(false);
cfg.setDisableIdmEngine(true);
cfg.setTransactionsExternallyManaged(true);
cfg.setDataSource(tenantAwareDataSource);
cfg.setExpressionManager(new SpringExpressionManager(applicationContext, cfg.getBeans()));
cfg.setBeans(new SpringBeanFactoryProxyMap(applicationContext));
return cfg;
}
thanks for anyone help