I've been reading recently about Event First approach to microservices where Event Store is a Single Source of Truth for all the applications (https://dzone.com/articles/data-consistency-in-microservices-architecture).

enter image description here

This is very different from Change First approach were we:

  1. Save item to microservice database (in this scenario that database would be the source of truth)
  2. On success we send event with change to Event Stream

The Event First approach seems really interesting but there is one thing that's nagging me. How should the change be populated on the front end ?



  1. We create a new user on the UI. The change is send to BackEnd.
  2. BackEnd writes the change to EventStore and subscribes to it but the change is not yet populated in its database. Request is returned to client.
  3. Asynchronously BackEnd tries to add user based on its subscription but it fails.
  4. On the UI user tries to edit the newly created record. Sends update request to backend. Should we at this point rely on the local database to check if the record exists and return an error ? We have inconsistency at this point and user will know about it but isn't it too late ? Or maybe this scenario is incorrect at some point.


  • Websockets, or SignalR, or whatever other mechanism you choose to employ. May 29, 2019 at 15:11
  • Thought experiment: What if you did things the usual way, but instead of your UI getting JSON from a service that interrogates the database, it gets the JSON from your event store or some caching mechanism? May 29, 2019 at 15:13
  • @RobertHarvey yes but what other mechanism would that be :) ? WebSockets were the only approach I could think of.
    – cah1r
    May 29, 2019 at 15:13
  • Why do you think you need Websockets? May 29, 2019 at 15:14
  • Actually thinking about it I was proposing WebSokects because then I would be able to return Id back to client. I don't have it when the record isn't actually written to the database. Also assuming that the operation failed when writing to Event Store I wouldn't see the record on the UI yet. Would relying on the natural keys and showing record on the UI even though it failed being saved to Event Store the correct approach in this scenario ?
    – cah1r
    May 29, 2019 at 15:24


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy