Conflict detection

91 views
Skip to first unread message

Troy Hart

unread,
Feb 20, 2018, 3:12:55 PM2/20/18
to Axon Framework Users
I am a little confused about command processor conflict detection in general and how it is compared/contrasted against optimistic concurrency control. In a Denver workshop last week, Allard suggested (unless I mis-understood him) that he never sees the case that calls for optimistic concurrency control. For clarity, what I am calling optimistic concurrency control is when I include a @TargetAggregateVersion annotation on one of the property/methods of a given command and upon command execution the framework ensures that the value of the annotated property/method matches the value of the latest event sequence for the given aggregate.

  1. So what am I missing? To me it seems like the case for optimistic concurrency control is very common, in any domain.
  2. If conflict is not based on optimistic concurrency control, then what are the conditions under which conflict scenarios are detected?

Thanks!

Troy Hart

unread,
Feb 22, 2018, 10:10:04 PM2/22/18
to Axon Framework Users
I know this question is not very well constructed and I apologize for that. I'm also pretty sure we talked some about conflict detection in Denver, I'm just not fully getting it yet. 

Allard Buijze

unread,
Feb 23, 2018, 10:23:03 AM2/23/18
to axonfr...@googlegroups.com
Hi Troy,

no apologies necessary.  We did talk about it in Denver, but it's not rare that people "zone out" when processing that much information ;-)

Axon uses optimistic concurrency whatever the approach is. Aggregates emit events using a sequence number. If two different instances (on different nodes, for example) emit events simultaneously, they will use the same sequence number, causing a conflict.
However, this does not take into account that users look at data, spend some time thinking about the next action and then submit their decision in case of a command. This is where conflict resolution comes in. While this user was thinking, someone else might have made a decision as well. Let's call this user A, and the one that took too long thinking B.

When B's command arrives, it will carry an @TargetAggregateVersion annotated field. An aggregate is loaded. The version of that aggregate will be higher than @TargetAggregateVersion of B, because A has made a change in the meantime. Big question is: is that a problem. The conflict resolver will receive the events that A produced to make it's decision. If it's not a problem, B's events are just appended. Otherwise, an exception is thrown.

The remark I made about "not seeing the case" was rather that I personally didn't need this in any of the projects I was directly involved with. That's because conflict could be mapped to the current state, as opposed to "unseen" changes. That doesn't mean they aren't there. In fact, I've heard of some interesting cases where conflict resolution was a great means.

Hope this clarifies things for you.
Cheers,

Allard

Op vr 23 feb. 2018 om 04:10 schreef Troy Hart <troy...@gmail.com>:
I know this question is not very well constructed and I apologize for that. I'm also pretty sure we talked some about conflict detection in Denver, I'm just not fully getting it yet. 

--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Allard Buijze
CTO

E: allard...@axoniq.io
T: +31 6 34 73 99 89

altug sahin

unread,
Mar 4, 2018, 3:32:37 PM3/4/18
to Axon Framework Users
I DID zone out! Don't remember a thing about that! :)

Troy Hart

unread,
Mar 5, 2018, 2:47:12 PM3/5/18
to Axon Framework Users
HA HA! Day two was pretty densely packed with information right! :)

altug sahin

unread,
Mar 5, 2018, 5:42:55 PM3/5/18
to Axon Framework Users
I know it was awesome and exhausting at the same time. It was nice meeting with all of the participants.
Reply all
Reply to author
Forward
0 new messages