Class ConflictDiagnosingEventStorageEngine

java.lang.Object
org.axonframework.eventsourcing.eventstore.ConflictDiagnosingEventStorageEngine
All Implemented Interfaces:
DescribableComponent, EventStorageEngine

@Internal public class ConflictDiagnosingEventStorageEngine extends Object implements EventStorageEngine
Decorator for an EventStorageEngine that, upon an AppendEventsTransactionRejectedException, identifies an event that caused the rejection.

It does so by sourcing the same criteria used for the rejected append, starting from the violated consistency marker, and taking the first event returned. Any event returned by that lookup matches the criteria beyond the marker, which is exactly what an append rejection reports. The lookup always identifies a genuine conflicting event, regardless of how many criteria the condition combines, and without needing any storage-engine-specific knowledge of how the conflict was detected. Only the first match is fetched, closing the underlying read as soon as it is found, since a single example is enough to confirm and reproduce a conflict.

This lookup is an additional read against the wrapped delegate, performed only after a rejection has already occurred, so it does not add cost to the common, successful append path. It is not enabled by default; wrap an EventStorageEngine with this decorator to opt into it, for example while reproducing a specific issue.

All other operations are delegated to the wrapped engine unchanged.

Since:
5.3.2
Author:
John Hendrikx