RetryPolicy.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/client/RetryPolicy.hpp"

RetryPolicy

Class to control retries in RequestExecutor.

namespace oatpp { namespace web { namespace client { 
  class RetryPolicy {}
}}}

Methods

Return Type Name Summary
[none] ~RetryPolicy Virtual destructor.
bool canRetry Check if the context is eligible to retry.
bool retryOnResponse Check whether the client should retry for a given response from the server.
v_int64 waitForMicroseconds How much client should wait before the next attempt?

RetryPolicy::~RetryPolicy

Virtual destructor.

virtual ~RetryPolicy() = default

RetryPolicy::canRetry

Check if the context is eligible to retry.

virtual bool canRetry(const Context& context) = 0

RetryPolicy::retryOnResponse

Check whether the client should retry for a given response from the server.

  • @param responseStatusCode - HTTP status code of the response.
  • @param context - RetryPolicy::Context.
  • @return - true - to retry. false - do NOT retry.

virtual bool retryOnResponse(v_int32 responseStatusCode, const Context& context) = 0

RetryPolicy::waitForMicroseconds

How much client should wait before the next attempt?

virtual v_int64 waitForMicroseconds(const Context& context) = 0

RetryPolicy::Context

This structure holds information about request attempts.

namespace oatpp { namespace web { namespace client { 
  class RetryPolicy {
    struct Context {}
  };
}}}

Fields

Type Name Summary
v_int64 attempt Attempt number.

RetryPolicy::Context::attempt

Attempt number.

v_int64 attempt = 0