Questions tagged [hexagonal-architecture]

The Hexagonal Architecture is a software architecture proposed by Alistair Cockburn. It is also called Ports and Adapters. It is similar to the Onion Architecture proposed by Jeffrey Palermo.

Alistair Cockburn proposed the Hexagonal Architecture, also called Ports and Adapters. The architecture is similar to the Onion Arcitecture proposed by Jeffrey Palermo.

The fundamental motivation of the approach is to avoid layer-to-layer dependencies usually associated with the N-tier architecture approach. This is achieved by placing all infrastructure, including databases, outside the problem domain.

The problem domain is then completely independent of the required infrastructure (testing, databases, security, etc.). For example, this means that testing database accesses can be done thoroughly without a real database.

176 questions
1
vote
2 answers

What nested class type is best suitable for Domain Events?

I am following Domain Driven Design and Clean/ Hexagonal architecture in my Java microservice. I have domain events declared in my aggregate root class as non-static nested classes. My question is whether these classes should be static nested…
1
vote
1 answer

Should application layer be aware of the caching mechanism, or could it belong to the infrastructure layer?

Let's assume I have an API endpoint which needs some Product data to process the requests properly. Imagine that there's some application layer service which has to handle the contract (let it be a query for example). The application layer service…
Bulchsu
  • 580
  • 11
  • 33
1
vote
2 answers

Updating multiple entities with DDD

I am working on an application with Spring Boot and Java and JPA. I am going with DDD and it has multiple modules, the application, the domain, and the infrastructure layer. The domain is in plain Java. I have a domain entity Account. One user can…
1
vote
2 answers

Is there a way of unit testing what imports are used?

Is there a way of unit testing what modules are imported in a Python file (a bit like ArchUnit in Java)? The context is in implementing a hexagonal architecture and wanting to ensure that the domain model does not import any code that resides in an…
John
  • 10,837
  • 17
  • 78
  • 141
1
vote
1 answer

Java integration test with fake outbound call

I work on a Java project using Spring framework, JUnit and Mockito. The application is in the middle of a chain with others application, so it exposes inbound ports (e.g. an HTTP API) to be called and uses outbound ports (e.g. web services and…
1
vote
2 answers

Is there an elegant solution for handling callbacks from external devices in clean architecture?

I am building a complex system, based on clean architecture (https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html), using many external components, for example a payment terminal. The mentioned payment terminal has a library…
1
vote
1 answer

Is seed data part of domain layer?

I like to organise packages in my solutions to correspond three classical onion architecture layers: domain application infrastructure Let's consider an example exchange application which calculates stock prices. This example application might…
Bulchsu
  • 580
  • 11
  • 33
1
vote
2 answers

Create method to calculate a field in the Domain or in the Service

If we have a Class Book and we want to calculate the score of a Book following some rules like "if the number of pages is lower than X then we need to substract Y from the score" and using an Hexagonal Architecture. Should we place this method…
1
vote
1 answer

Where to instanciate adapters in hexagonal architecture

I am building a simple application with the trying to follow best practices with hexagonal architecture. My main entry point is my manual dependency injection starter, I usually considered this code as the application part but I have to instanciate…
1
vote
1 answer

Prepare audit events based on domain models

I have application which acts as a proxy between different systems without own database. There are few possible use cases which are covered by the application: Display data from specific system or systems Store data to specific system or…
fashuser
  • 2,152
  • 3
  • 29
  • 51
1
vote
1 answer

Ports and Adapters – Should interfaces specify arguments as domain objects?

When specifying a port, should that interface define it's arguments in terms of domain objects e.g. interface AddUser { firstName: FirstName lastName: LastName } and simple or "plain" types e.g. interface AddUser { firstName: string …
SuperJumbo
  • 519
  • 3
  • 13
1
vote
3 answers

How to force or lead adapters to throw specific exceptions in Hexagonal/ Ports and Adapters Architecture in Java?

While trying to implement Hexagonal/Ports-and-Adapters architecture in Java in practice, I have problems to integrate exception handling. Say there is a RentBookPort secondary port interface like public interface RentBookPort { void…
1
vote
3 answers

Why repositories work with domain entities?

In DDD, I've seen the following code many times where an entity is passed as parameter to the save method of a repository. class MysqlUserRepository { public function save(User $user) {} } As far as I know, infrastructure shouldn't know…
1
vote
0 answers

hexagon-sim WARNING: DRIL in dril.cpp:6843: Unable to load symbols from exe file

Can you tell me how to solve it? "hexagon-sim INFO: The rev_id used in the simulation is 0x00004060 (v60a_512) hexagon-sim WARNING: uiLoadElfSymfile in dril.cpp:5902: Cannot find string table in ELF file hexagon-sim WARNING: DRIL in dril.cpp:6843:…
mhx
  • 11
  • 1
1
vote
2 answers

JPA Entity is not mapped

I have Spring microservicies application using hexagonal architecture. When try to get data from my H2 database using hql query I have an exception which say my Entity is not mapped. My Entity is subclass of another one who have commons…