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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.