- Microservices with Clojure
- Anuj Kumar
- 426字
- 2021-06-30 19:24:31
Hexagonal architecture
Hexagonal architecture (http://alistair.cockburn.us/Hexagonal+architecture), also known as the ports and adapters pattern, aims to decouple business logic from other parts of the component, especially the persistence and services layers. A component, built on the ports and adapters pattern, exposes a set of ports to which one or more adapters can be added as necessary. For example, to test and verify the core business logic in isolation, a mock database adapter can be plugged in and later replaced with a runtime database adapter in production.
A port is an entry point that is provided by the core business logic to interact with other parts of the component. An adapter is an implementation of a port, and there may be more than one adapter defined for a single port based on the requirement. For example, a REST adapter is used to accept requests from external users or other microservices components. It internally calls the service API port defined by the core business logic that performs that requested operation and generates a response. Similarly, a database adapter is used by the core business logic to interact with the external database via its database port, as shown in the following diagram:

Based on their applicability and usage, the REST adapter and database adapter are often referred to as primary and secondary adapters respectively. Similarly, the service API port and database port are referred to as primary and secondary ports respectively. Primary ports are called by the primary adapters and they act as the main interface between the core business logic and its users, whereas secondary ports and secondary adapters are used by the core business logic to generate events or interact with external services, like a database. Primary adapters help validate service requests with respect to a service schema and call core business logic functions, whereas the core business logic calls the functions of secondary adapters to help translate the application schema to the external service schema, like that of a database. Primary adapters are initialized with the application, but references to the secondary adapters are passed to the core business logic via dependency injection.
- FreeSWITCH 1.2
- Web安全防護(hù)指南:基礎(chǔ)篇
- 物聯(lián)網(wǎng)識別技術(shù)
- 數(shù)字烏托邦
- Force.com Development Blueprints
- 局域網(wǎng)組建、管理與維護(hù)項目教程(Windows Server 2003)
- 信息通信網(wǎng)絡(luò)建設(shè)安全管理概要2
- 網(wǎng)絡(luò)的琴弦:玩轉(zhuǎn)IP看監(jiān)控
- 世界互聯(lián)網(wǎng)發(fā)展報告·2019
- Microsoft Dynamics CRM 2011 Applications(MB2-868) Certification Guide
- 網(wǎng)絡(luò)環(huán)境中基于用戶視角的信息質(zhì)量評價研究
- 光纖通信系統(tǒng)與網(wǎng)絡(luò)(修訂版)
- 5G時代的大數(shù)據(jù)技術(shù)架構(gòu)和關(guān)鍵技術(shù)詳解
- 深入理解計算機(jī)網(wǎng)絡(luò)
- NB-IoT原理和優(yōu)化