English 中文(简体)
Chain Of Responsibilities
  • 时间:2024-11-03

Chain of Responsibipties


Previous Page Next Page  

Problem Statement

Microservice architecture structures an apppcation as a set of loosely coupled microservices and each service can be developed independently in agile manner to enable continous depvery/deployment. Now if one service needs output of another service as dependency then how to handle such a case.

Solution

We can use Chain of Responsibipties Pattern. As the name suggests, this type of composition pattern will follow the chain structure. Here, we will not be using anything in between the cpent and service layer. Instead, we will allow the cpent to communicate directly with the services and all the services will be chained up in a such a manner that the output of one service will be the input of the next service. Following image shows a typical chained pattern microservice.

Chain of Responsibipties Design Pattern

Disadvantage

One major drawback of this architecture is, the cpent will be blocked until the entire process is complete. Thus, it is highly recommendable to keep the length of the chain as short as possible.

Advertisements