blackcompe
blackcompe

Reputation: 3190

Axon: Expecting constraint violation for existing @Aggregate using EmbeddedEventStore

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?

Upvotes: 1

Views: 224

Answers (1)

Lucas Campos
Lucas Campos

Reputation: 1920

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.

Upvotes: 1

Related Questions