Multiple DB, SpringAxonAutoConfigurer selecting bad TransactionManager

Hi all, in my application I use two different DB (PostgreSQL to SagaStore and TokenStore, MSSQL to saved results there) when I start app I see this log Multiple beans of type PlatformTransactionManager found in application context: [mssqlTransactionManager, postgresTransactionManager]. Chose mssqlTransactionManager. So this is wrong, how can I ensure SpringAxonAutoConfigurer always uses the correct transactionManager in this case postgresTransactionManager?

Hi Antiek, I’m not sure picking the postgresTransactionManager will solve the problem, as by doing so probably the projection will also end up on PostgreSQL.
Is there a good reason to use different DB’s? If all the changes are not part of the same transaction, you are likely to have inconsistencies at some point.

Hi Gerard, I use 2 different DB because MSSQL DB it is not my property and I can only post the results there, not other things needed for the application to run. With @Bean postgresTransationMenager I added @Primary annotation and it looks like everything works fine so for now problem solved, but I’m curious on what basis SpringAxonAutoConfigurer selects which TransactionMenager to use and if there is, for example, an some Axon annotation that tells it to take directly these?

Spring is picking either one here, you can supply your own TransactionManager bean to have more control.