grpc-spring icon indicating copy to clipboard operation
grpc-spring copied to clipboard

新增对ServiceConfig配置的支持

Open wushengju opened this issue 4 years ago • 5 comments

1.新增之后需要进行如下所示的配置 grpc.client.tcl-cloud-provider.retry-enabled=true grpc.client.tcl-cloud-provider.method-config[0].name[0].service=helloworld.Greeter grpc.client.tcl-cloud-provider.method-config[0].name[0].method=SayHello grpc.client.tcl-cloud-provider.method-config[0].retry-policy.max-attempts=3 grpc.client.tcl-cloud-provider.method-config[0].retry-policy.initial-backoff=1 grpc.client.tcl-cloud-provider.method-config[0].retry-policy.max-backoff=1 grpc.client.tcl-cloud-provider.method-config[0].retry-policy.backoff-multiplier=2 grpc.client.tcl-cloud-provider.method-config[0].retry-policy.retryable-status-codes=UNKNOWN,UNAVAILABLE 2.测试结果如下 image


EDIT by @ST-DDT

English

References:

  • https://github.com/grpc/proposal/blob/master/A6-client-retries.md
  • https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/internal/RetryPolicy.java

wushengju avatar Aug 11 '21 01:08 wushengju

Thanks for your contribution.

There are some small changes I would like to see before merging this. See my comments for details. Also please run ./gradle spotlessApply before committing. Lastly, please add a test that ensures this works as expected and does not break unnoticed in a future release.

If you need help with any of these, feel free to ask me and I will try to help you.

I have settled your proposal and also add GrpcChannelPropertiesGivenMethodConfigUnitTest for test

wushengju avatar Aug 12 '21 09:08 wushengju

I'll try to add some integration tests that actually test, that the retry/service config is working. Maybe I can also tweak the datatypes a bit to simplify the configuration some more.

ST-DDT avatar Aug 23 '21 21:08 ST-DDT

I'll try to add some integration tests that actually test, that the retry/service config is working. Maybe I can also tweak the datatypes a bit to simplify the configuration some more.

Ok just do it

wushengju avatar Aug 25 '21 09:08 wushengju