|
49 | 49 | import org.apache.flink.util.Preconditions;
|
50 | 50 | import org.apache.flink.util.UserCodeClassLoader;
|
51 | 51 |
|
52 |
| -import software.amazon.awssdk.awscore.exception.AwsServiceException; |
53 |
| -import software.amazon.awssdk.awscore.internal.AwsErrorCode; |
54 | 52 | import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
|
| 53 | +import software.amazon.awssdk.core.internal.retry.SdkDefaultRetryStrategy; |
55 | 54 | import software.amazon.awssdk.http.SdkHttpClient;
|
56 | 55 | import software.amazon.awssdk.http.apache.ApacheHttpClient;
|
57 | 56 | import software.amazon.awssdk.retries.AdaptiveRetryStrategy;
|
@@ -202,40 +201,19 @@ private DynamoDbStreamsProxy createDynamoDbStreamsProxy(Configuration consumerCo
|
202 | 201 | consumerConfig.addAllToProperties(dynamoDbStreamsClientProperties);
|
203 | 202 |
|
204 | 203 | AWSGeneralUtil.validateAwsCredentials(dynamoDbStreamsClientProperties);
|
205 |
| - int maxDescribeStreamCallAttempts = sourceConfig.get(DYNAMODB_STREAMS_RETRY_COUNT); |
| 204 | + int maxApiCallAttempts = sourceConfig.get(DYNAMODB_STREAMS_RETRY_COUNT); |
206 | 205 | Duration minDescribeStreamDelay =
|
207 | 206 | sourceConfig.get(DYNAMODB_STREAMS_EXPONENTIAL_BACKOFF_MIN_DELAY);
|
208 | 207 | Duration maxDescribeStreamDelay =
|
209 | 208 | sourceConfig.get(DYNAMODB_STREAMS_EXPONENTIAL_BACKOFF_MAX_DELAY);
|
210 | 209 | BackoffStrategy backoffStrategy =
|
211 | 210 | BackoffStrategy.exponentialDelay(minDescribeStreamDelay, maxDescribeStreamDelay);
|
212 | 211 | AdaptiveRetryStrategy adaptiveRetryStrategy =
|
213 |
| - AdaptiveRetryStrategy.builder() |
214 |
| - .maxAttempts(maxDescribeStreamCallAttempts) |
| 212 | + SdkDefaultRetryStrategy.adaptiveRetryStrategy() |
| 213 | + .toBuilder() |
| 214 | + .maxAttempts(maxApiCallAttempts) |
215 | 215 | .backoffStrategy(backoffStrategy)
|
216 | 216 | .throttlingBackoffStrategy(backoffStrategy)
|
217 |
| - .retryOnException( |
218 |
| - throwable -> { |
219 |
| - if (throwable instanceof AwsServiceException) { |
220 |
| - AwsServiceException exception = |
221 |
| - (AwsServiceException) throwable; |
222 |
| - return (AwsErrorCode.RETRYABLE_ERROR_CODES.contains( |
223 |
| - exception.awsErrorDetails().errorCode())) |
224 |
| - || (AwsErrorCode.THROTTLING_ERROR_CODES.contains( |
225 |
| - exception.awsErrorDetails().errorCode())); |
226 |
| - } |
227 |
| - return false; |
228 |
| - }) |
229 |
| - .treatAsThrottling( |
230 |
| - throwable -> { |
231 |
| - if (throwable instanceof AwsServiceException) { |
232 |
| - AwsServiceException exception = |
233 |
| - (AwsServiceException) throwable; |
234 |
| - return AwsErrorCode.THROTTLING_ERROR_CODES.contains( |
235 |
| - exception.awsErrorDetails().errorCode()); |
236 |
| - } |
237 |
| - return false; |
238 |
| - }) |
239 | 217 | .build();
|
240 | 218 | DynamoDbStreamsClient dynamoDbStreamsClient =
|
241 | 219 | AWSClientUtil.createAwsSyncClient(
|
|
0 commit comments