English version: English
When to Use
- Bounded contexts have been fully defined, and their collaboration and integration relationships need to be designed.
- It is necessary to clarify "who depends on whom, what pattern is used for integration, and who owns the contract".
ddd-model-reviewWhen "integration patterns and mappings are inconsistent" is reported, re-execute as a backtracking target.
Input Requirements
- Required: Context catalog (from
ddd-contexts), cross-boundary points in the event flow hotspot annotations (fromddd-discover)。 - Optional: Subdomain classification table (from
ddd-subdomains, used to understand the business weight of contexts), existing interfaces/messages/data exchange methods, team collaboration patterns.
Process
- Enumerate Relationships: List all context pairs, annotating dependency direction and data/event flow direction.
- Select Patterns: For each pair of relationships, select an integration pattern—ACL (Anti-Corruption Layer), OHS (Open Host Service), PL (Published Language), Shared Kernel, Conformist, Customer-Supplier—and explain the rationale for the choice.
- Define Translation: Clarify input translation, output translation, semantic difference handling, and field mapping rules.
- Contract Ownership: Clarify the Owner, consumers, change process, and release strategy for each contract.
- Failure Mode Analysis: For each integration point, analyze failure modes such as timeout, degradation, idempotency, retry, compensation, and data latency.
- Versioning Strategy: Define compatibility windows, deprecation strategy, contract testing requirements, and release cadence.
Output
| Artifact | Structural Requirements |
|---|---|
| Context Relationship Matrix | Table: upstream, downstream, pattern, data/event, risk |
| Contract Ownership Matrix | Table: contract, Owner, consumers, change process, release strategy |
| Translation and ACL Decisions | Table: object/event, translation rules, semantic difference description, implementation location |
| Failure Modes and Mitigation | Table: failure mode, impact, detection method, mitigation measures, compensation strategy |
| Versioning Strategy | List: version naming rules, compatibility window, deprecation strategy, contract testing requirements |
Validation Checklist
- All cross-context interactions have explicit patterns and ownership
- Inputs to the core domain are protected by an ACL or an equivalent translation boundary
- At least 5 failure modes are identified with actionable mitigation measures
- No circular dependencies (if any exist, they must be flagged as risks with decoupling solutions provided)
- The versioning strategy covers backward compatibility windows and the deprecation process
Backtracking Triggers
- A circular dependency is detected, or a single context bears > 3 upstream relationships → backtrack to
ddd-subdomainsorddd-contexts(there may be a "god context" or subdomain misclassification). - Triggered by
ddd-model-review: the tactical layer discovered new integration requirements that are inconsistent with the current mapping.
Example
@ddd-context-map
基于以下上下文目录,帮我设计上下文间的集成关系:
- Booking(预订全生命周期)
- Room Catalog(会议室资源管理)
- Identity(用户认证与授权)
请输出关系矩阵、集成模式选择、契约所有权与失败模式分析。