@Bean
AggregateConfigurer<TheAR> configureProcessAR() {
return AggregateConfigurer.defaultConfiguration(TheAR.class);
}
@Bean
EventStorageEngine eventStorageEngine(DataSource dataSource,
TransactionManager transactionManager) {
JdbcEventStorageEngine jdbcEventStorageEngine = new JdbcEventStorageEngine(
new SpringDataSourceConnectionProvider(dataSource), transactionManager);
// because the jdbc event storage engine does not create the tables automatically
jdbcEventStorageEngine.createSchema(HsqlEventTableFactory.INSTANCE);
return jdbcEventStorageEngine;
}
@Bean
PropagatingErrorHandler propagatingErrorHandler() {
return PropagatingErrorHandler.instance();
}
@Bean
SimpleCommandBus commandBus(TransactionManager transactionManager) {
// instantiate the commandbus to add a message monitor
SimpleCommandBus simpleCommandBus = new SimpleCommandBus(transactionManager, messageMonitor());
simpleCommandBus
.registerHandlerInterceptor(new TransactionManagingInterceptor<>(transactionManager));
simpleCommandBus.setRollbackConfiguration(RollbackConfigurationType.ANY_THROWABLE);
return simpleCommandBus;
}