Axon SpringTransactionManager Clarification



  • Simple CommandBus
  • RabbitMQ backed Event Bus
  • Oracle RDBMS (Aggregates - JPAStore)
  • No EventSource Repo

TransactionManager injection: (Spring’s PlatformTxnMgr)

Hi Jebu,

to be slightly safer, it’s better to use unitOfWork.publish(…) instead of publishing directly to the event bus. That will ensure publication to the event bus is done at the correct time.
My personaly experience is that there is no need for 2PC in this case. Appending events into the event store is the only thing that can fail for functional reasons. Therefore, it that succeeds, only technical issues can cause true problems. There is a very small window of opportunity between the event publication commit and the commit to the database for errors to occur. But I’m pretty sure this window of opportunity also exists with 2PC.