-
Notifications
You must be signed in to change notification settings - Fork 467
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
add functionality to retry an InvalidArgumentException #1270
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,8 @@ public class PollingConfig implements RetrievalSpecificConfig { | |
|
||
public static final Duration DEFAULT_REQUEST_TIMEOUT = Duration.ofSeconds(30); | ||
|
||
public static final int DEFAULT_MAX_RECORDS = 10000; | ||
|
||
/** | ||
* Configurable functional interface to override the existing DataFetcher. | ||
*/ | ||
|
@@ -71,7 +73,7 @@ public PollingConfig(KinesisAsyncClient kinesisClient) { | |
* Default value: 10000 | ||
* </p> | ||
*/ | ||
private int maxRecords = 10000; | ||
private int maxRecords = DEFAULT_MAX_RECORDS; | ||
|
||
/** | ||
* @param streamName Name of Kinesis stream. | ||
|
@@ -129,6 +131,14 @@ public void setIdleTimeBetweenReadsInMillis(long idleTimeBetweenReadsInMillis) { | |
this.idleTimeBetweenReadsInMillis = idleTimeBetweenReadsInMillis; | ||
} | ||
|
||
public void maxRecords(int maxRecords) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: setMaxRecords(...); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The class has an annotation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vincentvilo-aws this broke backwards compatibility. The method needed to return PollingConfig. See #1274 and #1275 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching this. The |
||
if (maxRecords > DEFAULT_MAX_RECORDS) { | ||
throw new IllegalArgumentException( | ||
"maxRecords must be less than or equal to " + DEFAULT_MAX_RECORDS + " but current value is " + maxRecords()); | ||
} | ||
this.maxRecords = maxRecords; | ||
} | ||
|
||
/** | ||
* The maximum time to wait for a future request from Kinesis to complete | ||
*/ | ||
|
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.
If this is going to be public and static, we can share this value in the multilang as well so that there is one central source of truth.
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.
as a follow up, it may be worth checking to see how many of these types of values we have "copy pasted" in multiple locations and see if its worth centralizing them.