My application is configured to use a JPA backed EventSourced repository on the command side, and an external event handler uses JDBI with a second data source to insert corresponding data into the query side db. In blue sky operation everything is working very nicely with my client able to do the full round trip - query from the query db, send commands to my Axon 'core' through a restful interface - the resulting Events are stored with JPA, and events result in inserts to the query db, which the UI client can re-read etc etc
I am examining how/where the application handles transactions - I have created an Axon SpringTransactionManager (itself backed by a JPA PlatformTransactionManager), and injected that transaction manager into my command bus. My application is currently structured such that each command results in a single Event, for better or worse.
Is it possible to include the insert to the query side database inside the transaction that the EventStore will be using?
Is it generally desirable to do so?
Any and all guidance on transactions and Axon greatly appreciated!
Phil