Skip to content
v2.274.0

HttpRetryPolicy Struct ​

HTTP retry policy.

Example ​

ts
declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;

router.addRoute('route-http2-retry', {
  routeSpec: appmesh.RouteSpec.http2({
    weightedTargets: [{ virtualNode: node }],
    retryPolicy: {
      // Retry if the connection failed
      tcpRetryEvents: [appmesh.TcpRetryEvent.CONNECTION_ERROR],
      // Retry if HTTP responds with a gateway error (502, 503, 504)
      httpRetryEvents: [appmesh.HttpRetryEvent.GATEWAY_ERROR],
      // Retry five times
      retryAttempts: 5,
      // Use a 1 second timeout per retry
      retryTimeout: Duration.seconds(1),
    },
  }),
});

Properties ​

httpRetryEventsHttpRetryEvent[]http_retry_eventstyping.List[HttpRetryEvent]httpRetryEventsList<HttpRetryEvent>HttpRetryEventsHttpRetryEvent[]HttpRetryEvents*[]HttpRetryEvent= no retries for http events#
Specify HTTP events on which to retry.

You must specify at least one value for at least one types of retry events.

retryAttemptsnumberretry_attemptsint | floatretryAttemptsNumberRetryAttemptsdoubleRetryAttempts*float64required#
The maximum number of retry attempts.
retryTimeoutDurationretry_timeoutDurationretryTimeoutDurationRetryTimeoutDurationRetryTimeoutDurationrequired#
The timeout for each retry attempt.
tcpRetryEventsTcpRetryEvent[]tcp_retry_eventstyping.List[TcpRetryEvent]tcpRetryEventsList<TcpRetryEvent>TcpRetryEventsTcpRetryEvent[]TcpRetryEvents*[]TcpRetryEvent= no retries for tcp events#
TCP events on which to retry.

The event occurs before any processing of a request has started and is encountered when the upstream is temporarily or permanently unavailable. You must specify at least one value for at least one types of retry events.