Axon: Expecting constraint violation for existing @Aggregate using EmbeddedEventStore

188 Views Asked by At

As a follow-up to Axon Event Published Multiple Times Over Eventbus, when using an EmbeddedEventStore and publishing a command that will attempt to create an instance of an aggregate that already exists, Axon is not throwing an exception indicating the instance exists (or constraint violation), as is on the contrary, when using Axon's JPA event store. Is this the expected behavior? If so, why?

1

There are 1 best solutions below

0
Lucas Campos On

Recently our community filed a similar issue to our repo that I am going refer here.

Essentially the JPA or JDBC implementation are responsible for catching this kind of exceptions and translating them to something the Framework understands.

If that occurs, you should see an AggregateStreamCreationException dispatched, indicating that it failed and why it failed. If this is not happening I recommend you looking into your PersistenceExceptionResolver.

If you still see this happening after checking what I shared, this is likely a bug and in this case, feel free to open it on our repo as such.