Anti-Corruption Layer – How to Design Anti-Corruption Layer in DDD

cdesign-patternsdomain-driven-designjsonsoap

I'm getting ready to create an integration with a major external system and was wondering if my understanding of the design pattern for this in domain driven design was solid.

Considerations:
External System serves SOAP, mine's a web api 2 solution.
Full CRUD operations across many SOAP methods

My thoughts:

  1. Create a giant facade class that receives the data.
  2. Have each method in the facade call an adapter that then transforms the data from SOAP to a domain model.
  3. Call the adapter in infrastructure service class and pass it up into the domain.

Concerns:
Does this pattern sound correct? Is there a more fitting one for creating a clearly defined bounded context?

I'd be using infrastructure as a pass through to the domain, it wouldn't be doing much at this point, another option is to pass the adapter directly to a factory though I prefer going through infrastructure.

Conceptual Diagram I'm basing my design on:

Domain-Driven Design: Tackling Complexity in the Heart of Software By Eric Evans

Best Answer

An Anti-corruption layer is a class/ package/component that take as an input the external model and it produces the local model.

For example, in a CQRS architecture, it can be implemented as a Saga: would take the events generated by the aggregates in the external bounded context and would create commands for aggregates in the local bounded context.

Related Topic