Infrastructure Services

A service that interact with an external* resource to address a concern that is not part of the primary problem domain e.g., messaging platform, database platform

Defines a contract used by the Domain Objects to interact with outside services.

Keeps the model independent of the infrastructure details | dependencies

  • No Domain Logic
  • Single Responsibility
  • Standard Interface | Contract

Examples of Infrastructure

  • Logging system e.g., Fluentd, ElastiSearch
  • Notifications e.g., Email, SMS
  • Persistence mechanism e.g., Database, File system
  • External APIs e.g., Google maps, Salesforce API

In this illustration, the aggregate object is leveraging an external email service to send customer communications via emails using a well defined function (interface) sendEmail.

example-infra-service

If/when the underlying infrastructure is changed, the domain model/object does not have to change as long as the interface that exposes the external service stays the same. All such infrastructure changes are handled in the infrastructure service depicted as an API in the illustration.

example-infra-service