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

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.

主站蜘蛛池模板: 顺昌县| 佛山市| 海南省| 霍邱县| 靖江市| 连云港市| 土默特左旗| 浦北县| 古丈县| 新化县| 西乌| 乐业县| 东海县| 区。| 荆州市| 隆化县| 佛冈县| 阜新市| 谢通门县| 芜湖县| 中西区| 庆安县| 牟定县| 襄汾县| 威海市| 嵩明县| 台湾省| 砚山县| 石泉县| 河北区| 榆社县| 寻甸| 隆林| 双辽市| 高邑县| 平湖市| 兰西县| 临城县| 西乡县| 蓬安县| 扶绥县|