I’m planning on trying to run AxonFramework on Heroku. For high avalability I want to run two instances of the same command handlers. How would I go about making sure that they both keep up with the work but only one set of events come out in the end?
What I want to accomplish is two command handlers where one can die and be restarted (Heroku dynos are restarted at least once per day to keep them healthy) without the flow of commands being paused.
It will look something like this (–> == over the network) :
Client --> Commands over AMQP --> [ Axon Command handler server 1 (JPA EventStore) ] --> Events over AMQP --> View model handler
[ Axon Command handler server 2 (JPA EventStore) ]
Given the same set of commands, two command handlers running the same code should produce the same set of events (not considering external inputs). One thing I’ve been considering is to let them have their own independent event stores. Then I would let them each get a copy of every command from the queue and do their stuff at the same time. On the other side I would need some kind of event deduplicator to only get one set of events for the view handlers.
Is this a silly thing to do? How would you set this up?