What Happens In Axon When two service replicas publish command?

Hello,

I have a small question which i couldn’t find in the reference.

Considering i have sagas that are publishing commands based on events i assume that if i have replicas of axon application running, all replicas might catch an event and submit a command.

When I have 1000 replicas of service, would that mean that my aggregate will be flooded with 999 commands? considering that i handle idempotently within an aggregate, so the invariant wouldn’t be touched, no events published.
Maybe the axon server ensure some kind of duplicate command dispatching?

Thank you in advance.

//EDIT

The tracking processor is responsible for inter-network synchronization of event handlers? If replica 0 handles event with seq 0 it upserts the tracking processor in db, so the replica 1 starts off from event with seq 1 (not handling 0 at all)?

Hi Robert,

Your last reply is the key to this problem.

The Tracking Tokens used by Tracking Event Processors (TEP) delegate the sets of events which are handled by the TEP’s threads.
IT does so by requiring a claim on a Tracking Token segment prior to be able to handle any events.

So even in a replicated set up, which will duplicate your TEP’s as well, each thread is still required to lay a claim on a tracking token which isn’t replicated.
As the TEP is the default event processor type used within Axon Framework 4.x, each Saga you would create will by default receive it’s events through a TEP.
Granted, each application instance should be able to reach the exact same Tracking Token table to be able to share the workload of course.

Hope this clarifies things.

Cheers,
Steven

Thank you Steven for clarification.

This is going to be fun ; D

Cheers