CommandHandler triggered twice using DistributedCommandBus

Hi,

I am currently using Axon Distributed Command Bus and according to our logs, we had the same command fired to two different nodes (there is a difference of 500ms between them) so we ended up handling the same command twice on two different nodes. We are using eureka discovery service to register multiple nodes.

Anyone encountered the same problem?

Regards,
Jan

Hi Jan,

That’s, interesting, but in most scenarios not that big a deal.
Typically, a command is directed to a specific Aggregate instance, which will publish events to notify a certain command has been handled with.
These events are by default stored in an Event Store, but more importantly, there is a unique constraints on the AggregateId-SequenceNumber pair.

Thus, a command being handled on two different nodes, for the same aggregate instances, would result in an Exception that an event with the given aggregateId-seqNo pair was already stored.

Hence my guy tells me the chance is high you’re safe.
Regardless, this is an issue worth investigating nonetheless…

As you are referencing Eureka, I think it is safe to assume you are using the SpringCloudCommandRouter as the means to find the route for a given command when using the DistributedCommandBus.
Is that assumption correct?
Additionally, what version of framework and/or the Spring Cloud extension are you using?
Lastly, do you have a RetryScheduler configured in your set up?

Let’s try to figure this out Jan!

Cheers,
Steven