-
Notifications
You must be signed in to change notification settings - Fork 826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
新增对ServiceConfig配置的支持 #574
base: master
Are you sure you want to change the base?
Conversation
...configure/src/main/java/net/devh/boot/grpc/client/channelfactory/AbstractChannelFactory.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
...t-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/config/MethodConfig.java
Outdated
Show resolved
Hide resolved
...ing-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/config/RetryPolicyConfig.java
Outdated
Show resolved
Hide resolved
...ing-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/config/RetryPolicyConfig.java
Outdated
Show resolved
Hide resolved
...ing-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/config/RetryPolicyConfig.java
Outdated
Show resolved
Hide resolved
...boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/config/GrpcChannelProperties.java
Outdated
Show resolved
Hide resolved
I have settled your proposal and also add GrpcChannelPropertiesGivenMethodConfigUnitTest for test |
I'll try to add some integration tests that actually test, that the retry/service config is working. |
Ok just do it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed the first part and will hopefully finish it in the next few days.
TODO for me: Check whether the config metadata will be generated by spring.
if (properties.isRetryEnabled()) { | ||
builder.enableRetry(); | ||
// build retry policy by default service config | ||
// TODO: Wrap field in defaultServiceConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid conflicts with other values in the serviceConfig
it might be neccessary to wrap the methodConfig
property in a defaultServiceConfig
property for clarity.
builder.enableRetry(); | ||
// build retry policy by default service config | ||
// TODO: Wrap field in defaultServiceConfig | ||
builder.defaultServiceConfig(buildDefaultServiceConfig(properties)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default service config might be used outside of the retry logic.
So it might be neccessary to move it "elsewhere".
Hey |
Currently there appears to be merge conflicts, so this cannot be merged right now. |
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.测试结果如下
EDIT by @ST-DDT
English
References: