We are facing concurrency exception org.axonframework.repository.ConcurrencyException: Concurrent modification detected for Aggregate identifier issue when we are running our application on multiple instances using Distributed command bus with MetaDataRoutingStrategy. Both the instances are trying to modify same aggregate at the same time. We tried with conflict-resolver=“conflictResolver” and locking-strategy as “OPTIMISTIC” as well as PESSIMISTIC but issue persist.
Can you help to resolve this issue as in our application we have multiple instances which are accessing same aggregate. In axon documentation with the use of pessimistic lock strategy we can avoid concurrencyException. I am using below configuration ,is there any other configuration changes required ?
event-store=“eventStore” cache-ref=“aggCache” conflict-resolver=“conflictResolver” locking-strategy=“PESSIMISTIC”>
If it is possible to solve concurrencyException with “PESSIMISTIC” locking strategy is there any performance impact of the same.