Multiple events with the same ID in the event store?!

Hello everyone!

Our Team is currently exploring the axon Framework for a new Project,
and we built a Little Spring Boot application that uses Axonframework 3.0-M3.

We wrote a Little logic about commands and Events, that Primary does pretty much what the getting started supposes.
A test creates a command with some Parameters and expects a proper Event to appear (and is green).
The unexpected part is, that if we create multiple commands with the same Id (the id is annotated with @AggregateIdentifier),
no one cares. We thought, that the Event store should warn or throw an exception.

We use: SimpleCommandBus, DefaultCommandGateway, InMemoryEventStorageEngine, EmbeddedEventStore, SimpleEventBus, EventSourcingRepository.

So the question: Is it regular, that the EventStore equal id’s? If yes: Who is responsible to validate the uniqueness of ids? If not: Is it possible, that there is a bug, or should I probably use another EventStorageEngine to accomplish a uniqueness validation?

I appreciate any help on this Topic!

Regards, ϱbert

The id in the command that you annotated with @AggregateIdentifier refers to the id of the aggregate, not the id of the command. Axon uses this to load the correct instance of the aggregate from the store, and apply the command to it.


Hey Jorg and everyone,

I try to explain how we understood the concept (it is hard without official 3.0 documentation ;-)):

We have a Delivery, that is our Aggregate Root. That means, it has an @AggregateIdentifier (and in our case a command handler (CreateDeliveryCommand) and an event handler (DeliveryCreatedEvent)). These CreateDeliveryCommand has an id, that is annotated with @TargetAggregateIdentifier.
How do we assure the commands (and/or the events) uniqueness? The above approach seems to be wrong -.-
Another question (with the same background) is: Is it possible, that Delivery is our AggregateRoot and has an unique entity ID? How would we implement this properly?

It would be very helpful, if someone could explain as the right “architecture” for this case.

Kind Regards, ϱbert

You are responsible for generating the identifier of your AR and ensuring its uniqueness. The identifiers for events and commands are generated by Axon itself ( . A command has no notion of being unique, or do you mean uniqueness in the context of redelivery ?