2

In DDD implementation with Hexagonal Architecture the application might have ports (interfaces) and adapters (clients) .In my current project I am implementing Event driven based micorservices .I have a domain application service layer and and infrastructure layer and adapter layer (for commands listeners). I have googled many implementation and infrastructure layer contains the adapters as well as ports . now the infrastructure layer once will invoke the application service layer which is wrong as per my understating .

Is this correct implementation .where to add the the ports/command listeners.

1 Answers1

2

I do the following matching between DDD layers and hexagonal architecture:

  • The driver ports are the DDD application services interfaces, they are the left edges of the hexagon.

  • The inside of the hexagon is divided into the DDD application services implementation and the DDD domain model.

  • The driven ports (for example a repository interface, or a service interface that is implemented by infrastructure), are the right edges of the hexagon.

  • The inside of the hexagon implements the driver ports and use the driven ports.

  • A driver adapter (for example, a REST API controller, or a web app) uses/calls a driver port. The drivers adapters are the presentation layer of DDD.

  • A driven adapter implements a driven port. Driven adapters are the infrastructure layer of DDD.

If you want to take a look, here's an article I wrote explaining hexagonal architecture:

https://softwarecampament.wordpress.com/portsadapters

Hope it helps.

choquero70
  • 3,332
  • 2
  • 24
  • 40