GrpcRetryPolicy

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

Bases: HttpRetryPolicy

gRPC retry policy.

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

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

  • 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

  • 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

ExampleMetadata:

infused

Example:

# router: appmesh.VirtualRouter
# node: appmesh.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=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

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

retry_attempts

The maximum number of retry attempts.

retry_timeout

The timeout for each retry attempt.

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