News for hackers. Stuff that matters.
Re:Event Sourcing is Hard by dtech on Monday February 04, 2019 @03:31AM (#19074784)
There should be 1 point in the system that said "user x has ordered item a". That then becomes an event. The command from user x and y to order item a might be a race condition to see which command gets processed first, but once it has been turned into an event it's immutable and without race conditions. You should never replay commands.
Re:Event Sourcing is Hard by BlackFly on Monday February 04, 2019 @07:12AM (#19075646)
Event systems do not require deduplication and/or strong ordering on the ingress. You can also solve the problem on the consumption side and there are often reasons to do this.

Plus you should be more forgiving of examples. Let us strengthen the example by saying that the inventory system lied and told us there were 2 items when there was only one. So you issue 2 commands, but when the events arrive at the fully automated warehouse, one randomly receives a null pointer exception and auto-heals into a refund, but which one?

Re:Event Sourcing is Hard by mattknox on Tuesday February 05, 2019 @03:55PM (#19089750)
Here, you should have 2 orders issued events, one order_succeded, and one order_failed (hopefully not with an actual NPE, that would be pretty bad). So much like an SSTable-based system, there are race conditions at the level of deciding what to write to the logs/event stream, but should not be race conditions in replaying the event stream (the same customer would get a failure every time).
Re:Event Sourcing is Hard by bsaul on Monday February 04, 2019 @05:10AM (#19075152)
Never done event sourcing architecture, but i guess this kind of subtelty is what makes a system a nightmare or a breeze to work with.

Which makes me wonder if there are some kind of exercise book to practice « good architectural design » , just like with algorithms.