What is Chained or Chain of Responsibility Design Pattern

Previously we saw about What is Microservice? and the principles followed while developing MSA and the available design patterns. also, we saw an API Gateway design pattern.

Today we will see what is Chained or Chain of Responsibility Design Pattern is.

What is Chained or Chain of Responsibility Design Pattern?

The chained or Chain of responsibility pattern produces a single response which is a combination of multiple chained responses.

Example:

Consider we have Contact, Student & Fees three microservices, each web service communicates with the following or next service as in waterfall.

Yes, Contact service calls Student service and Student service calls Fees service. Response of Fees and Student will be returned back to Contact service.

What is Chained or Chain of Responsibility Design Pattern

Chained Or Chain Of Responsibility Design Pattern in Microservice

Here the Client must wait till the response comes back after the consolidated response is available, meaning the Client will be waiting for the chain of response to be returned back as a response.

Use this service where the client is not expecting any response. (Something like calling a batch job, synchronous tasks or orchestrated flow of actions.

All these services use the HTTP request or response for communicating,

Note: Each service request and response looks different from the chained flow.

 

In the next article, we will see Asynchronous Messaging design pattern.

 

LIKE | SHARE | SUBSCRIBE

WeCanCode-Author

WeCanCode-Author

November 07, 2021

Senior Developer | Java & C#.NET | 10++ years of IT experience.

Planning to learn ReactJS or Angular or Flutter.!

Please disable your adblocker or whitelist this site! We Provide Free content and in return, all we ask is to allow serving Ads.

Pin It on Pinterest

Share This
%d bloggers like this: