官术网_书友最值得收藏!

Direct lookup

Although microservices have their own isolated persistence, an application implemented using microservices may need to share data among a set of services to perform tasks. In a monolithic environment, since there is a common database, it is easier to share data and maintain consistency using transactions. In a microservices environment, it is not recommended to provide direct access to the database managed by a service, as shown in the following diagram:

For example, when a user places a new order, the Order Service may need access to the delivery address; that is, the user address from the User Service. Similarly, once the order is placed, the User Service would like to update the total orders placed till date by the user in its database. Since the user database is maintained by the User Service and the Orders Database is maintained by the Orders Service, these two services will get the required details via the APIs exposed by the other service only. They should not be allowed to directly update or access databases maintained by another service. This helps in always maintaining a single copy of the user and order databases that is not accessible to any other microservice directly.

主站蜘蛛池模板: 农安县| 宣恩县| 余江县| 富裕县| 湘阴县| 潼南县| 伊吾县| 漳州市| 永福县| 斗六市| 交城县| 黄浦区| 河南省| 上蔡县| 曲阜市| 江陵县| 三亚市| 邢台市| 科技| 高阳县| 和顺县| 安远县| 南宫市| 比如县| 英德市| 扬中市| 青铜峡市| 绥阳县| 青州市| 行唐县| 河津市| 剑阁县| 黄陵县| 江阴市| 五峰| 丰城市| 融水| 平顶山市| 建水县| 广灵县| 赤水市|