Question

How event sourcing can be combined with several types of dictionary objects like Country, Region, Time Zone etc. and dictionary types from particular domain model like Budget or Availability definitions. Some of dictionary objects should be possible to edit in admin UI but some not.

For example we decided, that we do not need admin UI for countries. Thus we do not need to implement AddCountry/RemoveCountry commands.

Should i generate set of CountryAdded events i.e. should i persist dictionary objects as stream of events? Do we ever use source of truth other then event stream?


In case i can go without event stream for dictionary objects, how you'll solve this problem:

Display list of countries with the number of users in each country.

In this case i need representation of Country objects in the read model with listener for UserAdded event.

Thank you.

Was it helpful?

Solution

If you use event sourcing as the persistence mechanism, then:

  • event stream is the only source of truth (object snapshots generated from event stream could be used to improve the performance, but they are just the technique).
  • When you use event sourcing, you don't need to generate event explicitly - just publish actual events generated while processing the command.
  • if you have a predefined list of countries, that are never going to change, you can just hard-code and reference them by their country codes. However this implies that view model and UI know about that and countries are not going to change.

BTW I recommend posting questions like these to DDD/CQRS group. It's the most active community on the questions of CQRS/DDD/ES.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top