Skip to content

[ggj] generate example of ApiCallContext.withRetrySettings on client #700

@noahdietz

Description

@noahdietz

googleapis/gax-java#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:

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.

I'm thinking it would be generated in this client-level doc comment block somewhere.

cc: @miraleung

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions