How to respond for partial failure in micro-services gateway?

Viewed 30

I am seeking your opinion on the following scenario. Imagine following microservices system.

  1. Microservice - A: This does some work/task A responseA: { key: value}
  2. Microservice - B: This does some work/task B responseB: { key: value}
  3. Gateway/Aggregator: This invokes Microservices A & B in parallel and combines the results. gatewayResponse: { responseA: { key: value}, responseB: {key: value}}

In an ideal scenario where both services are successful, then the above response "gatewayResponse" makes sense, i.e. HTTP STATUS CODE 200

My question is more regarding partial failure. Let's say service B is down or while executing a request it failed due to any reason, but service A is totally okay. In such a case how "gatewayResponse" should look like and what should be the HTTP STATUS CODE?

Solution - HTTP STATUS CODE 200 / should it be some other STATUS CODE??

gatewayResponse: {
 responseA: {
    key: value
 },
 responseB: {
    error: {
      "some details about error"
    }
 }

}

I would appreciate your response on this. Thank you in advance!

0 Answers
Related