Chapter 7. Integration of Bounded Contexts

In Chapter 5, you read about domain-driven design’s patterns for defining integrations between bounded contexts. In this chapter, we’ll talk briefly about those patterns from a tactical design perspective.

Partnership and Shared Kernel

Both the partnership and shared kernel patterns require well-established communication between teams and as many synchronization opportunities as possible. Therefore, it’s crucial to invest in an integration test suite that will verify the integrations between the bounded contexts. It’s also essential to set up a continuous integration pipeline that will execute those tests continuously and provide fast feedback about the committed changes.

Anticorruption Layer

This pattern protects the downstream context from the inconvenient model exposed by the upstream context. It translates the service’s provider’s model into a model driven by the consumer’s needs. Such translation can be implemented in different ways:

Local cache

The downstream consumer can implement a job that fetches data from the upstream service, transforms it, and stores the result in a local cache. If needed, this cache can be wiped and regenerated from scratch.

This approach is very similar to the implementation of projections in the CQRS architecture.

Adapter service

The downstream consumer can proxy all requests to the upstream service through a custom service. The adapter will call the upstream context, transform the result, and ...

Get What Is Domain-Driven Design? 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.