Retry Callout Policy Request

We have this requirement to retry using a service call if we receive a non-http 200 status response but non-http 5xx.

Here are context of what we are trying to achieve so far.

1. Only use service callout when calling a service.(Reason behind is in one flow we have multiple endpoints to call which each callout should have a retry of its own).

2. If service callout receives a specific http status code we do a retry. (e.g. HTTP 405)

3. Retry to be configured only on callout as we may change the retry counter in the future.

4. We do not resort to JavaScript as we wanted to utilized the service callout loadbalancing function.

Here some of the things we already tried so far.

1. Added <RetryEnabled>true</RetryEnabled> tagged in the Service Callout HTTPTargetConnection and added <MaxFailures>2</MaxFailures> in load balancer with 2 <Servers name="real"> and <Servers name="mock">. When tested "real" server returns error or connection error no retry was seen on trace and further more it did not even try the "mock" server.

2. Added <RetryEnabled>true</RetryEnabled> tagged in the Service Callout HTTPTargetConnection and added <MaxFailures>2</MaxFailures> in load balancer with 2 <Servers name="real"> and <Servers name="mock"> with mock set as <IsFallback>true</IsFallback> . When tested "real" with non http 200 response the "mock" will not be called but, when tested with "real" as unreachable host "mock" will only be then called. Note that trace do not show a retry happened but, it just resolve to "mock" when checking the callout trace.

Solved Solved
0 2 2,025
1 ACCEPTED SOLUTION

Would this work?:

transform the ServiceCallout into an API Proxy, with a real target. You can use the named Target Servers feature, which is what I think you want, to get the load balancing benefit you mentioned.

Then, in your original API Proxy, use a JavaScript Callout that invokes that API Proxy in a loop and retries as appropriate.

View solution in original post

2 REPLIES 2

Would this work?:

transform the ServiceCallout into an API Proxy, with a real target. You can use the named Target Servers feature, which is what I think you want, to get the load balancing benefit you mentioned.

Then, in your original API Proxy, use a JavaScript Callout that invokes that API Proxy in a loop and retries as appropriate.

Hi @Dino,

Thank you for the prompt response. Yes, that could work but on the original proxy we would want to not use JavaScript as much as possible.

Would retry be possible using normal callout only? if yes, is only connection error to target host can be retried?