jdutheil / booking-ddd

5 stars 1 forks source link

Consider using an event-bus #2

Closed tclasen closed 8 months ago

tclasen commented 8 months ago

https://github.com/jddw-dev/booking-ddd/blob/f2d6694ee69d5fec343ca45c98130f9fcd8af40c/TODO#L3

I recommend you use an event-bus to communicate events both across bounded contexts and even within specific aggregates. You can create a well-defined interface and some wrapper code, then chose any combination of implementations of an in-memory queue or a more persistent service like redit, rabbitmq, or kafka. You can even mix them like using a blocking in-memory queue for internal bounded context communications and for unit testing, then use rabbitmq for cross-boundary events. Up to you and your desired use case!

jdutheil commented 8 months ago

Yep that's what I did with NestJs included EventEmitter For now I'll stick with that in order not to add too much complexity, and I'll think again about it later if my needs are much higher