Hi everyone,
I am building a system in which there is a read model and a write model, each in a different BC, but in some cases the read BC doesnt have all the data it needs in the domain event that is sent by the write BC.
This data is not present in the same aggregate that fires the event, its present in multiple aggregates.
AFAIK I have two options:
1) Enrich the event in the write side before sending it to the read side, to do that there are two ways (AFAIK):
1.1) Create a data structure that is eventually consistent with the aggregates (updated by a custom event handler) in the write BC that contains the information I need to enrich the events, in this case the "Event enricher" would enrich the events before sending them to the read side.
1.2) Add getter methods to some of the aggregates and the "event enricher" would load the other aggregates it needs and use the getter methods to enrich the event before sending it to the read side
2) Dont enrich the event in the write side, create a data structure in the read side that contains all the extra information it needs to create all its views, and use this data structure together with the event that is received while doing the denormalization, this is basically the same as 1.1 but the data structure is on the read side.
I like option 1.1 best, but it involves creating yet another model to maintain (which can lead to more pain and suffering), but its easy to generate, and its disposable just like the read model, its kind of like an "integration model" that lets the write BC send events with information that their consumers need.
Has anyone solved this problem in a better way?
Thanks
PS: I can post a simple (real world) example of this, but I'll do that later if necessary