Skip to content

Should KinesisClient have a default RetryPolicy? #1469

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

Closed
sammefford opened this issue Oct 10, 2019 · 4 comments
Closed

Should KinesisClient have a default RetryPolicy? #1469

sammefford opened this issue Oct 10, 2019 · 4 comments
Labels
closed-for-staleness feature-request A feature should be added or improved. p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.

Comments

@sammefford
Copy link

Using Java maven dependency software.amazon.awssdk:kinesis:2.3.9 I was surprised that I got a NullPointerException when I tried this:

        kinesisClient = KinesisClient.builder()
            .region(region)
            .credentialsProvider(provider)
            .overrideConfiguration(config ->
                config.retryPolicy(config.retryPolicy().toBuilder()
                    .numRetries(5)
                    .build())
            )
            .build();

Expected Behavior

config.retryPolicy() would not be null by default, especially since the only code I see for Kinesis Client in this repo is KinesisRetryPolicy.java.

Current Behavior

config.retryPolicy() is null by default

@millems
Copy link
Contributor

millems commented Oct 10, 2019

Pretty much all configuration objects in the SDK are null by default, so that's the explanation for why this wouldn't work here (or anywhere else in the SDK, really).

That said, I can totally see how this behavior would be surprising to a lot of customers.

We could theoretically fix this one example, by having the consumer-builder variant of the method instantiate an empty client configuration, pre-populate it using the client defaults (which the client builder happens to know about) and then passing that through.

We can't do that everywhere in the client configuration, though. For example, HTTP client configuration defaults are controlled by the SDK core, so every HTTP client builder doesn't have access to the defaults until the HTTP client itself is created.

Because we can't support this feature request everywhere, my gut instinct would be to say that we shouldn't do it just for this one use-case. I wouldn't want people to have to learn "it works for X and Y, but not for A or B". Even if the current default behavior is surprising, it's consistent, and once someone learns the pattern they don't have to re-learn it for elsewhere in the SDK.

That said, I'm wide open to being convinced otherwise. It's a definite gray-area problem.

FYI for people who find this using google, the expected usage would be to do:

KinesisClient.builder()
             .region(region)
             .credentialsProvider(provider)
             .overrideConfiguration(config ->
                 config.retryPolicy(KinesisRetryPolicy.defaultPolicy()
                                                      .toBuilder()
                                                      .numRetries(5)
                                                      .build())
             )
            .build();

@millems millems added the feature-request A feature should be added or improved. label Oct 10, 2019
aws-sdk-java-automation added a commit that referenced this issue Jun 14, 2021
…4f621e6c5

Pull request: release <- staging/12a8e9e2-5ca4-42e8-9711-c6c4f621e6c5
@millems
Copy link
Contributor

millems commented Jul 21, 2021

There haven't been many upvotes on this issue since it was created, so we might close this issue soon unless there are strong objections.

@yasminetalby
Copy link

Hello all,

This feature-request did not have any additional interest/comment since Matthew's last check up. Let us know if this feature-request is still relevant.

We appreciate your feedback and contribution to improving the AWS Java SDK V2.

Sincerely,

Yasmine

@yasminetalby yasminetalby added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days. p3 This is a minor priority issue labels Nov 28, 2022
@github-actions
Copy link

github-actions bot commented Dec 3, 2022

It looks like this issue has not been active for more than five days. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please add a comment to prevent automatic closure, or if the issue is already closed please feel free to reopen it.

@github-actions github-actions bot added closing-soon This issue will close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will close in 4 days unless further comments are made. labels Dec 3, 2022
@github-actions github-actions bot closed this as completed Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness feature-request A feature should be added or improved. p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
Projects
None yet
Development

No branches or pull requests

3 participants