Reputation: 1674
What data should be contained in the event? Only data that is specific to this event or some data from boundary context too.
For example. I have account
with domain
and name
properties
account(id, name, domain)
When I change account name
NameChanged(id, name)
event is created. But when this event is used for read side projection
(cassandra db) I need to fill two tables (example does not use a materialized view):
accounts(id, name, domain) (primary key only `id`)
accountsByDomain(domain, id, name) (primary key contains `domain` and `id`)
Second table can not be synced by name
, because where is no domain
in the event.
Question: must be the event as simple as possible (and calls the state of the entity to get information that might have been different at the time the event occurred) or must it have complete information for read side projection
Upvotes: 0
Views: 71
Reputation: 57239
We aren't usually limited to processing an event in isolation - the identifiers in the event are available to allow us to look up the other information we need (which could, for example, be included in other events in the same stream).
Reviewing Greg Young's talk on Polyglot Data may help clarify this idea.
Upvotes: 1