Thanks for sharing that! The main point of an indexdb store imho is in occasionally connected scenarios eg: wAiting to sync.
Thanks, it’s good to see people taking up Promises (deferred objects).
I have also been toying with the idea of retrieving AR’s from the server and storing them in localstorage as JSON. Then having them process new events and storing the events for sync.
However this requires domain duplication, a domain on the server for hydration.
If I go down the client side ES path I should be able to keep one copy of the domain on the client, the server is just a pure ES. Merging would be done on the client.
@jon - In your example where are you doing your event sync and merge? Or do you not push the events of the client?
Adam
Node.js server? You can run projections at all places (db,node,browser)
Had a quick look at the projections in ES, very cool.
During my offline mode, do you have a mechanism that allows me to push events through the defined projections in the browser? Without going to the server?
When offline my domain would keep processing commands and producing events. I would need those to be processed by the projections to keep the read model up to date.
Does ES have any in-built store and forward capabilities if the server is not online?
Thanks
That was exactly my vision. In my domain the order of UnitsOfWork don’t really matter, so I don’t think I will need to rebuild the read model. I can just apply the new events.
This method saves duplication of domain on the server, but requires an EventStore.js (which you have written) on the client and some simple “service bus”, I had planned to use Rx.js
However Greg has got me thinking (whether intentionally or not J) of using his EventStore and its client projections.
I would host my domain in node.js and provide a thin service layer to retrieve my AR’s, which would all be preloaded into localstorage when the app started for the first time.
Then commands would be applied to my local domain and the events pushed to the server and into my local ES projections.
It just depends how much the EventStore provides for offline use (I haven’t had time to dig yet). Ideally it would handle the caching of events and posting to the server once a connection was made (with some hook for conflict resolution) as well as allowing for events to be pushed through the local projections (rather than a server round-trip).
I’ll go for the option that requires me to write the least infrastructure code J
Thanks for sharing, it’s nice to know the ideas you come up with aren’t entirely of the wall.
Adam
Are you able to pull out any of this infrastructure code from your current code based?
Very interested in the IndexedDBEventStore and whatever does your merging.
How do you handle version numbers? Do you rewrite the client stream? So nothing is “committed” till it hits the server?
Thanks
Adam
From: ddd...@googlegroups.com [mailto:ddd...@googlegroups.com] On Behalf Of Jonathan George
Sent: 14 November 2012 12:53