Please let me know if there is a better place to ask this question.
What are patterns that engineers have used to successfully “manage” the eventual consistency concept between the UI and backend (between Command and Query)? I think this is what makes most people nervous about embarking on an ES voyage.
For example, over the last couple of days, I’ve been running stress tests against a simple sandbox. The test is a combination of requests that create and update, and requests that read. In general, performance is great. But, there is always the possibility that a Projection may not have been updated yet. Under reasonable duress, I’m seeing over a second elapsed time between event storage (Command side) and when the projection EventHandler completes and the data would be available for query (Projection side). Using the gateway sendAndWait has helped minimize the gap, but it still exists.
If the UI sends a query request and the data isn’t there, should the UI just retry in a couple of seconds? Should the UI know if it sent a query request with a bad ID, or if the request is OK but the respective event handling is lagging behind slightly? Or is the UI workflow suppose to be designed to avoid immediately querying data that should have been just updated? <= My assumption so far
I keep feeling like the Command results in a ‘promise’ to the user that the projection side will be updated soon, and there should be a way to let the UI know when the projection has been updated. I’m trying hard to evolve my thinking from traditional immediate update workflows, and it’s hard.