our backend service's load balancer is not stable, in order to increase our HA, we want to add a retry function on apigee edge layer.
the idea is like this:
client send a request to apigee api proxies, when target endpoint return a 503 service unavailable error, apigee api proxy wait for 500ms , then resend request to this target endpoint again, if it fail again on second attempt, then an error message will be returned back to client.
could this be done ?
Dear @Yu.Huang ,
Welcome to Apigee Community 🙂
Yes, It's possible. You can use Service Callout Policy in response flow when ever target endpoint returns 503. Have a flag like variable so that you won't end up with infinite loop to break same.
Cheers,
Anil Sagar
could you elaborate a bit more on this?
as i understand, using a servie callout policy means building a request from scratch and then invode an external api.
however, we already added several policies in request's preflow, if we do a service callout policy , how could we simply reuse those policies we have done to the request ?
a small example will be greatly appreciated.
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |