I'm exploring Event Carried State Transfer patter, I understand how it works, but there is one problem I don't know how to solve.

So, in ECST, a service can listen to events and then build a private state from those events. As an example - let's say I have a User service and my service consumer CRUD-like user-related events to build a private state about the users I need in my service. I can nicely update that state when I receive an event - but how can I bootstrap the state of my service with data that already existed before I released my service?

The simplest idea is to have an API that the service can query to fetch all users, but that sounds nor right as it couples the consumer with the producer.


The usual mechanism is a combination of snapshots and replays. This means that you store all of the events that lead to the current state for a given number of events, and then periodically you "flatten" them into a snapshot of the state at that time, and store it. The next time you need to bootstrap an instance, you load the latest snapshot and replay the remaining (unflattened) events that have occurred since that snapshot.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.