googleapis / googleapis/google-cloud-java

[sdk-platform-java] [ggj] generate example of ApiCallContext.withRetrySettings on client

未关闭
#12,543 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
priority: p3 type: feature request
主要语言
Java
星标
2.1k
派生
1.2k
平均合并
1 天 23 小时
30 天内合并 PR
157

描述

https://github.com/googleapis/gax-java/pull/1238 introduced a new feature to the `ApiCallContext` that allows end users to supply `RetrySetttings` to be used for a single method invocation. The examples and documentation in the PR are generic, and show how to create an entirely new `RetrySettings` instance to supply via `withRetrySettings`, but there is API specific documentation that ggj could generate that would greatly help users. We should generate a single, client-level example of configuring `RetrySettings` via the `ApiCallContext` in the GAPIC layer that utilizes that GAPIC's `StubSettings` class as a base `RetrySettings` to modify. An example usage is as follows:

```java
LanguageServiceClient client = LanguageServiceClient.create();

// In order to adjust the RetrySettings on a per-call basis, modify the default settings
// and supply it via the ApiCallContext.
RetrySettings retrySettings =
client
.getSettings()
.analyzeSentimentSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(10L))
.builder();

ApiCallContext callContext = GrpcCallContext.createDefault().withRetrySettings(retrySettings);

client.analyzeSentimentCallable().call(request, callContext);
```

_Note: The spacing is probably off there._

A similar existing example in [`LanguageServiceStubSettings`](https://github.com/googleapis/java-language/blob/master/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStubSettings.java#L70-L85).

I'm thinking it would be generated in this [client-level doc comment](https://github.com/googleapis/java-language/blob/master/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java#L61-L91) block somewhere.

cc: @miraleung

贡献指南

打开贡献指南

调研方向

从 google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java 中的客户端级文档注释开始,并与 LanguageServiceStubSettings.java 中现有的示例进行比较。跟踪这些注释的生成方式,然后添加一个生成的客户端级示例,展示如何使用以 StubSettings RetrySettings 为基础的 ApiCallContext.withRetrySettings;当该示例正确出现在生成的 GAPIC 客户端中时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
documentation
Issue 类型
文档
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。