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.
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.
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 ?