Multiple nodes running query model

Hi,

I’am working on a setup with 3 nodes (more in the future) running our axon application in a docker container on docker swarm. The commands / external events are passed in from an external system using RabbitMq and are the picked up by one of the nodes. The evenstore is postgres database based on the JpaEventStorageEngine and is of course accessible for all the nodes, the same goes for the JpaSagaStore.

We use blue/green deployments, so at a given time there are some nodes running the new version and some the old version of the software.

What I would like to is that each node has it’s own (embedded H2) query store where the projections are stored. They each use trackingProcessors with the InMemoryTokenStore so after a restart or deployment all events are processed again, because the tokenstore is empty initially. This gives us ultimate flexibility of changing the model of the query store / projections and prevents issues with breaking changes in the model which would affect the other nodes still running the old version of the model it the would share the query store.

So far so good. But during processing of an external events, domain events are generated and they should also be picked up by the other nodes to update their own query model. Otherwise the query models are not in sync with each other.

What is the best way to achieve this or is there a better solution to prevent breaking changes in the query stores?

Regards,

Frank

Because you have query store for every instance, so you should make sure the events are got by every one. So you can try fanout mode, like a pub/sub.

Thanks Mavlarn,

But what is the best way to achieve this? Every event should be published exactly once by each node.

Hi Frank,

If I understand correctly, you have a single Event Store which is accessible by all (three) nodes in your system, correct?

You also state that one of these nodes will receive the external events and adjust them in one way or another into domain events.

If you have a single event store, then those domain events are stored in the same event store as all the other nodes are using.

As such every node can see every event.

If you mix that with Tracking Event Processor to update your query model, then every node should already get all the events which happen in your system.

This is with I take from your explanation Frank.
Am I missing something importantly that this didn’t seem to work in your situation?

That’s my two cents.

Cheers,
Steven

Hi Steven,

Thanks for your reply.

At the time of writing I didn’t realize that also the internal domain events are also written to the even store.

But everything works fine and since you also don’t see an issue with setup we will stick with this.

Thanks,

Frank

Hi Frank,

Great to hear it turned out you didn’t have any issues!
If you’ve got any future questions in regards to the framework, feel free to post another question.

Cheers,

Steven