Is this a readmodel?

116 views
Skip to first unread message

hector.T

unread,
May 5, 2013, 7:22:10 AM5/5/13
to ddd...@googlegroups.com
Hi,

I might be confused with some terminology so don't hesitate to correct me.

Events generated by my write model can be handle by my readmodel and can also cross the boundaries of my bounded context and be handled in other bounded context?

If this is correct, if I handle the events in a bounded context B, and B is also implemented using CQRS, is it consider as handled in a readmodel?

Thanks

Marco Heimeshoff

unread,
May 5, 2013, 8:02:56 AM5/5/13
to ddd...@googlegroups.com
Your other bounded context should consume events from context A via an adapter and translate what has happened to its own events. Then you could either use them in a readmodel as well as to rehydrate your aggregates etc...

ContextA.SthHasHappened -> ContextB.SthHasHappened


2013/5/5 hector.T <htwi...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "DDD/CQRS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dddcqrs+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



hector.T

unread,
May 5, 2013, 11:44:21 AM5/5/13
to ddd...@googlegroups.com
"to rehydrate your aggregates etc..."

I supposed you are meaning trigger a behavior of my other context.
Let's say the event from context A is supposed to trigger a behavior of an aggregate in context B;

SomethingInAHasHappened -> DoSomethingInB -> SomethingIInBHasHappened

From where should I send the DoSomethingInB command?

Alexey Raga

unread,
May 6, 2013, 5:32:51 AM5/6/13
to ddd...@googlegroups.com
I tend to model it it the following way:
You will have what is usually called a "Port" in "hexagonal" architecture.

Port's job is to sit there and listed to things from outside the context and "translate" them into something meaningful for their contexts (usually to commands: how the context is supposed to react).
It is exactly how you wrote it: [SomethingInAHasHappened -> DoSomethingInB] -> SomethingIInBHasHappened. The blue thing in red brackets is what the port would do.

Technically it is just another class that handles (external) events and publishes (internal) commands.

Cheers,
Alexey.

hector.T

unread,
May 6, 2013, 9:59:40 AM5/6/13
to ddd...@googlegroups.com
Thanks :)

I would like to ask a last question about readmodels.
If I have a handler in the bounded context A which handle the SomethingInAHasHappened and build a readmodel based on the event. If I have a report which display all the "Something" happened in A, where is the UI supposed to be? In the bounded context A? Or elsewhere?

I'm asking this based on all examples that I see on internet, it looks like all UI related parts are out on any BC. Where should I put it?

Thanks!

Reply all
Reply to author
Forward
Message has been deleted
0 new messages