aws-cdk-lib.aws_appmesh.GrpcRetryPolicy

interface GrpcRetryPolicy

LanguageType name
.NETAmazon.CDK.AWS.AppMesh.GrpcRetryPolicy
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsappmesh#GrpcRetryPolicy
Javasoftware.amazon.awscdk.services.appmesh.GrpcRetryPolicy
Pythonaws_cdk.aws_appmesh.GrpcRetryPolicy
TypeScript (source)aws-cdk-lib » aws_appmesh » GrpcRetryPolicy

gRPC retry policy.

Example

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

router.addRoute('route-grpc-retry', {
  routeSpec: appmesh.RouteSpec.grpc({
    weightedTargets: [{ virtualNode: node }],
    match: { serviceName: 'servicename' },
    retryPolicy: {
      tcpRetryEvents: [appmesh.TcpRetryEvent.CONNECTION_ERROR],
      httpRetryEvents: [appmesh.HttpRetryEvent.GATEWAY_ERROR],
      // Retry if gRPC responds that the request was cancelled, a resource
      // was exhausted, or if the service is unavailable
      grpcRetryEvents: [
        appmesh.GrpcRetryEvent.CANCELLED,
        appmesh.GrpcRetryEvent.RESOURCE_EXHAUSTED,
        appmesh.GrpcRetryEvent.UNAVAILABLE,
      ],
      retryAttempts: 5,
      retryTimeout: Duration.seconds(1),
    },
  }),
});

Properties

NameTypeDescription
retryAttemptsnumberThe maximum number of retry attempts.
retryTimeoutDurationThe timeout for each retry attempt.
grpcRetryEvents?GrpcRetryEvent[]gRPC events on which to retry.
httpRetryEvents?HttpRetryEvent[]Specify HTTP events on which to retry.
tcpRetryEvents?TcpRetryEvent[]TCP events on which to retry.

retryAttempts

Type: number

The maximum number of retry attempts.


retryTimeout

Type: Duration

The timeout for each retry attempt.


grpcRetryEvents?

Type: GrpcRetryEvent[] (optional, default: no retries for gRPC events)

gRPC events on which to retry.

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


httpRetryEvents?

Type: HttpRetryEvent[] (optional, default: 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.


tcpRetryEvents?

Type: TcpRetryEvent[] (optional, default: 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.