Pushing complete notifications to client
Posted
by
ton.yeung
on Programmers
See other posts from Programmers
or by ton.yeung
Published on 2013-08-12T21:31:28Z
Indexed on
2013/10/19
10:13 UTC
Read the original article
Hit count: 275
cqrs
So with cqrs, we accept that consistency is eventual.
However, that doesn't mean that the user has to continually poll, or that eventual means an update has to take more then 500ms to sync.
For the sake of UX, we want to at least give the illusion of consistency, or if not possible, be as transparent as possible.
With that in mind, I have this setup:
- angularjs web client, consumes
- webapi restful services, sends commands to
- nservicebus command handlers, saves to
- neventstore, dispatches events to
- nservicebus event handlers, sends message to
- signalr hub, sends notifications to
- angularjs web client
so with that setup, theoretically
- some initiates a request
- the server validates the request
- sends out the necessary commands
In the mean time
- the client gets a 200 response
- updates the view: working on it
- gets message sometime later: done, here's the updated data
Here's where things get interesting, each command could spawn multiple events. Not sure if this is a serious no, no, or not, but that's how it is currently. For example, a new customer spawns CustomerIDCreated, CustomerNameUpdated, CustomerAddressUpdated, etc...
Which event handler needs to notify the client? Should all of them in a progress bar style update?
© Programmers or respective owner