Summary
We learned in this chapter that adapters are used to define the technologies that are supported by a hexagonal application. We created two input adapters to allow driving operations, that is, a REST adapter to receive data from HTTP connections and a CLI adapter to receive data from STDIN
. Both input adapters were attached to the same input port, allowing the hexagonal system to use the same logic to process requests coming in distinct formats.
Then, we created an H2 database output adapter and a JSON file output adapter to make the hexagonal application communicate with different data sources. These two output adapters were attached to the same output port, enabling the hexagonal system to persist and obtain data from external sources so that the data source technology did not influence the business logic.
By knowing the purpose of input and output adapters and understanding how to implement them, we can now create systems that can tolerate significant technological...