GrpcRetryEvent Enum
gRPC events.
| Source | aws-appmesh/lib/route-spec.ts |
|---|
Example
ts
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),
},
}),
});
python
# 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)
)
)
)
java
VirtualRouter router;
VirtualNode node;
router.addRoute("route-grpc-retry", RouteBaseProps.builder()
.routeSpec(RouteSpec.grpc(GrpcRouteSpecOptions.builder()
.weightedTargets(List.of(WeightedTarget.builder().virtualNode(node).build()))
.match(GrpcRouteMatch.builder().serviceName("servicename").build())
.retryPolicy(GrpcRetryPolicy.builder()
.tcpRetryEvents(List.of(TcpRetryEvent.CONNECTION_ERROR))
.httpRetryEvents(List.of(HttpRetryEvent.GATEWAY_ERROR))
// Retry if gRPC responds that the request was cancelled, a resource
// was exhausted, or if the service is unavailable
.grpcRetryEvents(List.of(GrpcRetryEvent.CANCELLED, GrpcRetryEvent.RESOURCE_EXHAUSTED, GrpcRetryEvent.UNAVAILABLE))
.retryAttempts(5)
.retryTimeout(Duration.seconds(1))
.build())
.build()))
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
VirtualRouter router;
VirtualNode node;
router.AddRoute("route-grpc-retry", new RouteBaseProps {
RouteSpec = RouteSpec.Grpc(new GrpcRouteSpecOptions {
WeightedTargets = new [] { new WeightedTarget { VirtualNode = node } },
Match = new GrpcRouteMatch { ServiceName = "servicename" },
RetryPolicy = new GrpcRetryPolicy {
TcpRetryEvents = new [] { TcpRetryEvent.CONNECTION_ERROR },
HttpRetryEvents = new [] { HttpRetryEvent.GATEWAY_ERROR },
// Retry if gRPC responds that the request was cancelled, a resource
// was exhausted, or if the service is unavailable
GrpcRetryEvents = new [] { GrpcRetryEvent.CANCELLED, GrpcRetryEvent.RESOURCE_EXHAUSTED, GrpcRetryEvent.UNAVAILABLE },
RetryAttempts = 5,
RetryTimeout = Duration.Seconds(1)
}
})
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var router VirtualRouter
var node VirtualNode
router.addRoute(jsii.String("route-grpc-retry"), &RouteBaseProps{
RouteSpec: appmesh.RouteSpec_Grpc(&GrpcRouteSpecOptions{
WeightedTargets: []WeightedTarget{
&WeightedTarget{
VirtualNode: node,
},
},
Match: &GrpcRouteMatch{
ServiceName: jsii.String("servicename"),
},
RetryPolicy: &GrpcRetryPolicy{
TcpRetryEvents: []cONNECTION_ERROR{
appmesh.TcpRetryEvent_*cONNECTION_ERROR,
},
HttpRetryEvents: []HttpRetryEvent{
appmesh.HttpRetryEvent_GATEWAY_ERROR,
},
// Retry if gRPC responds that the request was cancelled, a resource
// was exhausted, or if the service is unavailable
GrpcRetryEvents: []GrpcRetryEvent{
appmesh.GrpcRetryEvent_CANCELLED,
appmesh.GrpcRetryEvent_RESOURCE_EXHAUSTED,
appmesh.GrpcRetryEvent_UNAVAILABLE,
},
RetryAttempts: jsii.Number(5),
RetryTimeout: awscdk.Duration_Seconds(jsii.Number(1)),
},
}),
})
Members
| Member | Description |
|---|---|
CANCELLED | Request was cancelled. |
DEADLINE_EXCEEDED | The deadline was exceeded. |
INTERNAL_ERROR | Internal error. |
RESOURCE_EXHAUSTED | A resource was exhausted. |
UNAVAILABLE | The service is unavailable. |
Referenced by
GrpcRetryPolicy.grpcRetryEventsgrpc_retry_eventsgrpcRetryEventsGrpcRetryEventsGrpcRetryEvents