ContextMapper / context-mapper-examples

ContextMapper DSL: Examples
https://contextmapper.org/
Apache License 2.0
197 stars 78 forks source link

Add an example in an asynchronous scenario #24

Open jabrena opened 2 years ago

jabrena commented 2 years ago

Hi,

In the last months, I was exploring the project and I liked to much because the DSL allow exploring the different scenarios designed by Eric Evans:

but in relation to the technical context map patterns, I didn´t find an asynchronous example for example using a Broker. Maybe at BC level, it is not necesary to represent the physical way to communicate 2 BC but I have the impression that:

Are more oriented to blocking communications. In the other hand, if one BC need to send a Domain Event, maybe every BC send a message based on a contract so it is a kind of PL.

image

What is your opinion?

Many thanks in advance

socadk commented 2 years ago

Thank you for your positive feedback and question, @jabrena

Here's my view: on higher levels of abstraction (BCs of type feature in CML), the technical realization of the relationship patterns is not defined. As a domain-driven design and its implementation evolve (and we go to system type BCs in CML), this of course is one if the important architectural decisions to be made, with HTTP, gRPC, and asynch. message queuing (ActiveMQ, RabbitMQ, etc.) as options on the tech. level.

The DDD books and supporting materials actually recommend to let Aggregates communicate asynchronously (see here and here for pointers), even within one BC.

In CML, we added a relationship attribute to the Context Map syntax to express this choice (see here). Not sure we already feature asynch. context rels. in the examples repo though, so thank you for the suggestions.

Events definitely have their place, see https://contextmapper.org/docs/event-sourcing-and-cqrs-modeling/

Hope this helps socadk aka Olaf