Creating an anti-corruption layer
In Chapter 2, Defining Boundaries and Letting Go, we highlighted the role that the Single Responsibility Principle (SRP) plays in helping to define a system's boundaries. Each bounded context should be responsible to one and only one actor. In other words, it is the actors who interact with a system that are the driving force behind any reason to change the system. So, we are obliged to draw boundaries around the interactions of the various actors to limit the impact of any changes they will cause.
We also identified three autonomous service patterns that each cater to a different type of actor. In this chapter, we dig into the details of the External Service Gateway (ESG) pattern. The ESG pattern works at the boundary of the system to provide an anti-corruption layer that encapsulates the details of interacting with other systems, such as third-party, legacy, and sister subsystems. These ESG services act as a bridge to exchange events with...