Search code examples
cqrsevent-sourcingneventstore

How do you handle historical aggregate data when starting a new event sourced system?


We are looking at building a new system based on event sourcing. Mainly for it's logging and integration benefits and because the business knows the data is very valuable but doesn't really know what it wants to do with it.

However, although the system is new, there is currently an existing database that has the aggregates current state stored in it. Pretty standard stuff - but we have no history so we just have the current state of play for all aggregates.

What is the standard approach to handle this situation?

  1. A single event that initializes the aggregate to its current state
  2. Map its current state to a serious of events and run those?
  3. Other approach? E.g. Its not a good idea

Anyone got any advice?


Solution

  • I'd recommend going for 1., e.g. storing a CustomerInitializedFromLegacyDB event having the existing data as payload.