English 中文(简体)
Event Sourcing and dictionary objects
原标题:

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.

最佳回答

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.

问题回答

暂无回答




相关问题
How to "join" two Aggregate Roots when preparing View Model?

Assume that Book and Author are Aggregate Roots in my model. In read model i have table AuthorsAndBooks which is a list of Authors and Books joined by Book.AuthorId When BookAdded event is fired i ...

Event Sourcing and dictionary objects

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 ...

Event Sourcing and Read Model generation

Assuming Stack Overflow domain problem and the following definition of events: UserRegistered(UserId, Name, Email) UserNameChanged(UserId, Name) QuestionAsked(UserId, QuestionId, Title, Question) ...

Inter-Aggregate Communication in CQRS + DDD + Event Sourcing

How should separate aggregate roots (AR) communicate with one another in an environment built on DDD principles using an event-sourced aggregate back-end? For instance, I have a Facility aggregate ...

热门标签