Hello guys,
I’m struggling with the conflict resolver mechanism even with the documentation and some examples.
I implement my own ConflictResolver class (let’s call it MyConflictResolver).
Meanwhile, I created a command handler method with a ConflictResolver as part of the inputs.
`
@CommandHandler
public void onMyCommand(MyCommand command, ConflictResolver resolver) {
…
}
`
Last but not least, to send a command I did it this way:
`
MyConflictResolver conflictResolver = new MyConflictResolver(eventStore, id, expectedVersion);
DefaultUnitOfWork.startAndGet(null).onPrepareCommit(uow -> conflictResolver.ensureConflictsResolved());
ConflictResolution.initialize(conflictResolver);
commandGateway.sendAndWait(command);
CurrentUnitOfWork.commit();
`
I have absolutely no idea then what to do. In the onMyCommand() method, I keep receiving a NoConflictResolver object instead of a MyConflictResolver.
Even worst, I do not understand the basic principles of the mechanism. In the onMyCommand() method, shall I call the detectConflicts() method or is it done automatically by the engine?
Any help would be much appreciated!
Thanks