org.axonframework.repository.ConcurrencyException: Concurrent modification detected for Aggregate identifier

Hi Allard,
We are getting org.axonframework.repository.ConcurrencyException: Concurrent modification detected for Aggregate identifier, frequently even if the sequence number generated is different.

The issues comes under this case

We have 2 instances of application. Commands distribution is done based on AnnotationRoutingStrategy. But on listener level request is not picked up based on the affinity. Now here it is noticed that request initiated by processing node, is received by other node and hence on command execution we receive this error

org.axonframework.repository.ConcurrencyException: Concurrent modification detected for Aggregate identifier

I am not aware of affinity at listener node to avoid this error. Is there something on configuration can be done to avoid this error.

Thanks,
Vijaya

Hi Vijaya,

this exception usually happens when the underlying database reports a Duplicate Key Violation when storing events. Did you configure the proper database transaction isolation level as I suggested in another thread?

Cheers,

Allard