Questions tagged [hexagonal-architecture]

The hexagonal architecture, also called ports and adapters architecture, aims at designing flexible component based architectures by decoupling the inner application core from the outside world by the mean of ports and adapters.

Filter by
Sorted by
Tagged with
1 vote
4 answers
210 views

Hexagonal Architecture: What is the purpose of the input ports?

Pretty simple question, but googling brought me nowhere: What is the purpose of input ports in the hexagonal architecture? We are doing Java and seem to have some misunderstandings regarding the input ...
user avatar
15 votes
4 answers
5k views

I can't really tell the difference between Hexagonal and Layered Architecture

So, in the hexagonal architecture layer, the application layer has incoming ports (usecases) that's called from incoming adapters, implemented by services, that uses outcoming ports that is ...
user avatar
0 votes
0 answers
31 views

Creating entity with external dependency inside the aggregateroot?

Okay, so, I'm working on an AuthService for my microservices system. I'm putting plenty of logic around single instance of User inside of it itself, just so I can avoid repeating code, breaking SRP or ...
user avatar
  • 221
0 votes
1 answer
111 views

.NET: Microservices, Hexagonal Architecture with lightweight DDD - how to avoid leaky abstraction without a major performance loss?

So, I have a whole system built as microservices.On a service level, I'm utilizing Hexagonal Architecture with lightweight DDD (no events, aggregators etc.) I have a service that fetches Users via ...
user avatar
  • 221
0 votes
0 answers
103 views

Are Hexagonal Adapters implemented Hexagonally?

I have a system implemented using Hexagonal/Ports and Adapters architecture. It's broken into three separate packages, API (driving ports/adapters), Model, and SPI (service provider interface, driven ...
user avatar
  • 2,341
-2 votes
2 answers
129 views

How widespread is the use of hexagonal architecture (ports and adapters architecture)? [closed]

We are discussing the adoption of hexagonal architecture (ports and adapters architecture) in our team. Sometimes I use the rate of adoption as one rough metric about how beneficial a certain practice ...
user avatar
0 votes
2 answers
124 views

May the left-side know the right-side when using CQRS with Hexagonal?

I'm trying to use the hexagonal architecture but I want the flexibility to make CUSTOM queries right to the database (or cache) to populate DTOs right from the left-side without passing through the ...
user avatar
  • 109
7 votes
3 answers
852 views

How does Hexagonal architecture solve N-tier's service spagetti?

I've seen a couple of talks on Hexagonal architecture where they illustrate problems with N-tier architecture. Specifically, they show a spaghetti of service layer dependencies as the software grows. ...
user avatar
  • 189
1 vote
2 answers
180 views

Catch "foreign" exception in adapter and convert them in own business exception is a good practice?

I am currently thinking about some design choices regarding exception handling. My current architecture looks a little like this: You can see that I have a UI where a try-catch middleware is cathing ...
user avatar
1 vote
0 answers
117 views

Where does a Process Manager live with a Hexagonal/Ports and Adapters Architecture?

Context: I initially asked this question. I lacked some understanding and phrasing to ask the actual question I wanted to ask. The answer though helped me understand the friction points a bit better ...
user avatar
  • 2,341
3 votes
1 answer
298 views

Is an Event Subscriber an Application Service, an Infrastructure Adapter, or something else?

I have two separate, isolated Domain-Driven Design contexts, and have a feature that needs to be implemented to integrate them together in some way. Both of these are broken down in a Hexagonal/Ports ...
user avatar
  • 2,341
4 votes
2 answers
479 views

Hexagonal/Clean Architecture - threads, locks, synchronization

All the examples across the internet try to pretend that every application is run on a single thread. There is no problem with synchronization, multithreading etc. Uncle Bob, in his "Clean ...
user avatar
2 votes
0 answers
465 views

How to achieve both: clean (hexagonal) architecture with JPA goodies?

How do I achieve two things at the same time writing Java Spring Application: Clean Architecture JPA goodies (@Transactional, Optimistic Locking, dirty checking, etc.) I like the idea of database/...
user avatar
0 votes
2 answers
2k views

How to handle different types of errors in Clean Architecture?

So, in the process of creating a user there are 4 possible outcomes: Username is already taken Email is already taken Username is invalid Email is invalid Here is what I have in the controller for ...
user avatar
  • 668
0 votes
2 answers
455 views

Separate DTOs consequently for each module?

Following the hexagonal architecture and package design you will have somewhere an entry point reaching to your core functionality. Often this is done by using a facade. To hide the core logic from ...
user avatar
  • 253
-3 votes
1 answer
51 views

In which layer should a `MailerInterface` be?

Speaking about DDD, in which layer should a hypothetical MailerInterface be? I know the implementation (or adapters) for each specific mail sender package should be in the infrastructure, but these ...
user avatar
1 vote
1 answer
160 views

Who does what and who lives where?

Hexagonal Architecture seems to make so much sense when I read about it (like more than I can say; the ultimate eureka moment), but actually implementing it is a different story. I more or less ...
user avatar
4 votes
3 answers
631 views

How does an hexagonal architecture help with async/await async-over-sync?

In his book "Concurrency in C# Cookbook", Stephen Cleary writes: If you can, try to organize your code along modern design guidelines, like Ports and Adapters (Hexagonal Architecture), which ...
user avatar
  • 231
2 votes
3 answers
406 views

UI Adapter Dependency on a Secondary (Driven) Port - Hexagonal Architecture

I am applying the Hexagonal Architecture (Ports and Adapters) to my system and I have noticed a dependency from my primary (driver) side adapter to the secondary (driven) side port. This doesn't seem ...
user avatar
  • 904
5 votes
1 answer
883 views

How to handle the Dependencies between Secondary Actor Adapters in the Hexagonal Architecture

I am applying the principles of Hexagonal Architecture (Ports and Adapters) and one aspect is slightly bothering me. In my opinion, the ports and adapters of the secondary actors should completely be ...
user avatar
  • 904
3 votes
2 answers
358 views

Can Time be a Primary Actor in the Hexagonal Architecture?

I really like the fundamental principles behind the Hexagonal Architecture (Ports and Adapters) and I have mostly applied it to my system/application. There is one thing that I wasn't able to ...
user avatar
  • 904
4 votes
1 answer
167 views

Hexagonal architecture and translations: how to model it properly?

Imagine a backend service modeled by a hexagonal architecture, where the domain has a class modeling, let us say, a Step of a creative flow that a mobile app will use: class Step( val stepId: ...
user avatar
  • 397
1 vote
1 answer
892 views

Domain Driven Design Validation Logic

I am trying to implement DDD along with Hexagonal Architecture. One of the things that I am struggling with is validations. I had explored a lot of articles on where the validation should be but it ...
user avatar
  • 59
3 votes
1 answer
349 views

Where should I implement Ports with Hexagonal Architecture?

I have been doing some research on the Hexagonal/Ports & Adapters architecture. For the most part, it makes a lot of sense. My initial understanding was that "Driver Ports" were to be implemented ...
user avatar
  • 139
2 votes
1 answer
738 views

Bounded contexts and domain-wide public REST API

I'm prototyping out an application here where I'm using domain-driven design to identify the domain(s) of the application and I've ended up with something that - at least so far - feels like a fairly ...
user avatar
9 votes
2 answers
2k views

In Hexagonal Architecture, can a UseCase call another UseCase?

My layers are like: Controller (Http) -> Use Case -> Domain Services Imagine that I have a PurchaseController which is just getting the parameters from the Http Request and calling the ...
user avatar
  • 199
2 votes
3 answers
1k views

Aren't Domain Driven Design/"hexagonal architecture" with real world constraints and the insistence on "non anemic model" contradictory?

DDD/"hexagonal architecture" insist on separating the domain, aka model, from infrastructure requirements. This looks clean and logical until you realize that storing your domain object in memory ...
user avatar
  • 414
1 vote
1 answer
96 views

Change request of a behaviour implemented deep in the call stack but is configured in the first calls

Problem: I have a complex system with many layers of abstractions. I need a different behaviour low in the abstractions, but to be configured high in the abstraction. Solution 1: Having a parameter ...
user avatar
  • 189
0 votes
1 answer
1k views

Hexagonal Architecture and database concurrency

I have been reading Alistair Cockburn's article on Hexagonal Architecture. One question that occurs to me, is how to handle situations where there are database concurrency issues. An obvious example ...
user avatar
  • 1,045
5 votes
2 answers
787 views

Dependencies within the inner hexagon of Ports and Adapters

In this article Mark Seemann explains how Onion/Hexagonal Architecture (or Ports and Adapters) are somewhat similar to a layered architecture when the Dependency Inversion Principle (DIP) is applied. ...
user avatar
8 votes
1 answer
4k views

Need explanation of hexagonal architecture

I am reading about Alistair Cockburn's Hexagonal Architecture with interest. One claim he makes is: Finally, the automated function regression tests detect any violation of the promise to keep ...
user avatar