HttpError503Handler Class

Namespace
Kampute.HttpClient.ErrorHandlers
Assembly
  • Kampute.HttpClient.dll

Definition

Handles '503 Service Unavailable' responses by retrying the request after a delay.
public class HttpError503Handler : RetryableHttpErrorHandler
Inheritance

Remarks

If the first '503 Service Unavailable' response of a call has a Retry-After header, the request is retried once, at the time the header suggests; a repeated 503 response then reaches the caller. Without the header, the request is retried as the HttpRestClient.RetryPolicy of the client decides. RetryableHttpErrorHandler.OnRetryPolicy can choose another policy. If a suggested time is further away than RetryableHttpErrorHandler.MaxRetryDelay, which is five minutes by default, the request is not retried. See RetryableHttpErrorHandler for how the retries of a call are decided.

Consider using TransientHttpErrorHandler if you want to handle multiple transient HTTP errors (including 503) with a single handler.

Methods

CanHandle(HttpStatusCode)

Determines whether this handler can process the specified HTTP status code.
public sealed override bool CanHandle(HttpStatusCode statusCode)

Parameters

statusCode HttpStatusCode
The HTTP status code to evaluate.

Returns

bool
true if the handler can process the status code; otherwise, false.

Remarks

This handler handles the '503 Service Unavailable' status code only.

See Also