Grpc client is not retrying and failed with UNAVAILABLE: io exception. Currently I am setting the retry and maxRetryAttempt like below:
Channel channel = NettyChannelBuilder.forAddress(address.getTarget(), address.getPort())
.enableRetry()
.maxRetryAttempts(3)
.intercept(interceptors)
.sslContext(context.build())
.build();
Is enableRetry and maxRetryAttempt supported in io.grpc:grpc-netty:1.18.0?
Thanks.
Neither enableRetry()
nor maxRetryAttempts()
configures retry on a per-method basis. enableRetry()
enabled the entire "subsystem," such that configuration will be followed; eventually it will be enabled by default, bu that wouldn't imply retries would happen for all methods. And maxRetryAttempts()
limits the configuration; if the configuration says to do 5 and you set the limit to 3, then only 3 will be done. But it doesn't increase the number of retry attempts.
The "configuration" that I keep referring to comes from service config. See gRFC A6 Client Retries for the configuration keys. Service config itself is not currently enabled by default as well. For retries, the easiest way to try it out is to use ManagedChannelBuilder.defaultServiceConfig(Map serviceConfig)
that was added to v1.20.0 (soon to be released). But you can also use TXT records in DNS and pass -Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true
when executing your binary.
Retries and service config are currently both experimental.