Skip to content

Retry with different call credentials #415

@asarkar

Description

@asarkar

Currently, I configure a CallCredentials bean that gets picked up by GrpcClientSecurityAutoConfiguration. Creating the call credentials involves acquiring a token by making more than one HTTP calls. For the purposes of this ticket, this token can be thought of as an OAuth token that has a certain expiration. What I'm looking to do is instead of acquiring the token before every call, cache the token once acquired, and if the server returns an authorization error, retry the call with a new token. Obviously, this will require some sort of information being passed from the interceptor that handles the response, and the CallCredentials bean. See an example of retrying interceptor here.

Note that gRPC has inbuilt retry mechanism, but it's idempotent, and doesn't allow for side-effects like refreshing a token.

This can all be done in the interceptor without any need for a CallCredentials bean, but IMO, it's cleaner (but more complicated) to separate the retry from the generation of CallCredentials.

Since Spring has a retry mechanism, I'm hoping this discussion may lead to such a feature in this library. If time permits, I will make a contribution. This ticket is to start the brainstorming process.

Metadata

Metadata

Assignees

Labels

documentationEverything related to the documentation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions