m-r icon indicating copy to clipboard operation
m-r copied to clipboard

Race between event handlers and read model facade after commands

Open t-nelis opened this issue 10 years ago • 1 comments

In case anyone's wondering, there are races between event handlers and the read model facade after commands are issued. This is due to the use of ThreadPool.QueueUserWorkItem in FakeBus.Publish.

You can test one for example by creating a new item and freezing one of the threads handling the InventoryItemCreated event (simulating a long database request); the resulting view will not display the item you just created.

Note that this is no eventual consistency matter.

This shouldn't impact the overall architecture which is the point of this project -- just pointing this out so that nobody embarks on a journey looking for magic and finding bugs instead.

t-nelis avatar Jan 08 '15 15:01 t-nelis

How to ensure the order of events? seems to be a contract that a Created_Event has to be processed by the handler before any following Changed_Events should be processed. Otherwise there are race conditions, too.

beachwalker avatar Jun 27 '16 12:06 beachwalker