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

Context boundaries

A module is just a way of defining a context boundary. If you want to migrate your existing monolithic application to a microservice-based application, you first have to identify a hidden context within your current application. This means we have to define the context and draw explicit context boundaries. This helps us design a robust microservice-based application.

For example, a typical online book shopping portal can have an order and shipping module using the same entity product. The following diagram shows the context boundaries of this application:

As you can see in the preceding diagram, the distributed application is based on different bounded contexts. The preceding design is a modular application design, where every module runs an independent process as a service. This is a decentralized approach to application design.

Once you have defined context boundaries, you can then easily decompose your existing monolithic application into a microservice-based application, where each bounded context has one microservice. In the example shown in the previous diagram, we have divided our monolithic application into four bounded contexts, which means that there are four microservices: Order Service, Book Service, Shipping Service, and Customer Service.

We now have a separate product entity in the Order Service and the Shipping Service, which each have their respective repositories. This concept can be extended by defining explicit context boundaries for the Stock and Inventory modules and creating an independent microservice for each.

Let's have a look at two different decomposition approaches. A monolithic application can be decomposed based on either its business capability or its domain.

主站蜘蛛池模板: 鄂伦春自治旗| 仪征市| 鸡西市| 宣汉县| 咸丰县| 上犹县| 通州市| 平果县| 翁牛特旗| 溧阳市| 高台县| 涡阳县| 江华| 广昌县| 花莲县| 新郑市| 吕梁市| 张家界市| 乌鲁木齐市| 罗城| 莒南县| 贵南县| 郎溪县| 福安市| 义马市| 平定县| 汝南县| 渝中区| 镇雄县| 库车县| 天长市| 濮阳县| 孝昌县| 姚安县| 班玛县| 绥江县| 中江县| 成武县| 竹溪县| 如皋市| 黄冈市|