GrpcRetryPolicy

class aws_cdk.aws_appmesh.GrpcRetryPolicy(*, http_retry_events=None, retry_attempts, retry_timeout, tcp_retry_events=None, grpc_retry_events=None)

Bases: aws_cdk.aws_appmesh.HttpRetryPolicy

gRPC retry policy.

Parameters
  • http_retry_events (Optional[Sequence[HttpRetryEvent]]) – Specify HTTP events on which to retry. You must specify at least one value for at least one types of retry events. Default: - no retries for http events

  • retry_attempts (Union[int, float]) – The maximum number of retry attempts.

  • retry_timeout (Duration) – The timeout for each retry attempt.

  • tcp_retry_events (Optional[Sequence[TcpRetryEvent]]) – 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. Default: - no retries for tcp events

  • grpc_retry_events (Optional[Sequence[GrpcRetryEvent]]) – gRPC events on which to retry. You must specify at least one value for at least one types of retry events. Default: - no retries for gRPC events

Example:

# router is of type VirtualRouter
# node is of type VirtualNode


router.add_route("route-grpc-retry",
    route_spec=appmesh.RouteSpec.grpc(
        weighted_targets=[appmesh.WeightedTarget(virtual_node=node)],
        match=appmesh.GrpcRouteMatch(service_name="servicename"),
        retry_policy=appmesh.GrpcRetryPolicy(
            tcp_retry_events=[appmesh.TcpRetryEvent.CONNECTION_ERROR],
            http_retry_events=[appmesh.HttpRetryEvent.GATEWAY_ERROR],
            # Retry if gRPC responds that the request was cancelled, a resource
            # was exhausted, or if the service is unavailable
            grpc_retry_events=[appmesh.GrpcRetryEvent.CANCELLED, appmesh.GrpcRetryEvent.RESOURCE_EXHAUSTED, appmesh.GrpcRetryEvent.UNAVAILABLE
            ],
            retry_attempts=5,
            retry_timeout=cdk.Duration.seconds(1)
        )
    )
)

Attributes

grpc_retry_events

gRPC events on which to retry.

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

Default
  • no retries for gRPC events

Return type

Optional[List[GrpcRetryEvent]]

http_retry_events

Specify HTTP events on which to retry.

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

Default
  • no retries for http events

Return type

Optional[List[HttpRetryEvent]]

retry_attempts

The maximum number of retry attempts.

Return type

Union[int, float]

retry_timeout

The timeout for each retry attempt.

Return type

Duration

tcp_retry_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.

Default
  • no retries for tcp events

Return type

Optional[List[TcpRetryEvent]]