-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document best practices for Eventual Consistency #189
Comments
@niko5 Thanks for this. I took the freedom to rephrase the title and format your message slightly I have some more ideas floating around and will try to formulate them asap |
Hi niko, thanks for the question! Though this is not specific to Neos.EventSourcing/Flow, it is a very fundamental question to any Event Sourced/Eventually Consistent system and here are some answers and possible solutions:
Well, yes, but no, not really. Really, don't do this. It doesn't solve the "problem" at all and makes your whole application less responsive and wonky.
You are on a good track here. You anyway need the (new) aggregate version number after a command in order to implement optimistic concurrency checks, so it's a good thing to return that version from the command handler. The same aggregate version can be used to query your read model with a constraint "at least version X". The main issue here comes with multi-aggregate ReadModels. Once you solved this you can then do this query in different ways - either (long) polling or even via websockets and push. Note here, that this query is the Here are some other approaches to the issue at hand, that are maybe non-obvious:
|
One very common requirement is the redirect to a newly created resource (e.g. signup).
|
Another option that I am interested in is Server-Send events and this is for the situation where there is a multi user web app that requires realtime background updates. However I am not sure if this is possible with Flow. |
you mean sth like websockets? |
Not web sockets Server Sent is a one way from server to client - seems easier than web sockets and fits quiet well with event sourcing . so I am thinking effectively of a controller which is a projector pushing events to the http client. Here is a link on server sent events |
Ah, thanks for clarifying. The foundation would be similar though: A mechanism that blocks until some projection is up-to-date. But sever sent events would make a nice usecase of course! |
FYI: (somewhat hacky) example for a ServerSent HTTP component: https://gist.github.com/bwaidelich/045a53c11d4b49e2a1a849185819493a |
Thanks 😊 I will take a look and test it out 😄 |
I am wondering if there are any best practices for implementing the UI where there is eventual consistency with Neos.EventSourcing and Neos.Flow.
At the moment with immediate consistency I post a Command, from a Fluid form, which is handled by the Command Action Controller this either loads the aggregate directly (or using a CommandHandler) completes the request then I am redirect to the query side which loads the page with the updated view. This all works fine when everything is synchronous.
However when moving to asynchronous listeners and projections what should one do? Here are some ideas of mine at the moment.
...
These are just some ideas that I am kicking around
The text was updated successfully, but these errors were encountered: