Communicating Between Bounded Contexts

How do bounded contexts communicate with each other? For example, when the order-taking context has finished processing the order, how does it tell the shipping context to actually ship it? As we’ve seen earlier, the answer is to use events. For example, the implementation might look like this:

  • The Place-Order workflow in the order-taking context emits an OrderPlaced event.
  • The OrderPlaced event is put on a queue or otherwise published.
  • The shipping context listens for OrderPlaced events.
  • When an event is received, a ShipOrder command is created.
  • The ShipOrder command initiates the Ship-Order workflow.
  • When the Ship-Order workflow finishes successfully, it emits an OrderShipped event.

Here’s a diagram for this ...

Get Domain Modeling Made Functional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.