Skip to content

Instantly share code, notes, and snippets.

@philgebhardt
Created December 18, 2017 22:13
Show Gist options
  • Select an option

  • Save philgebhardt/5bfa712dd0c99f06263ce6c4a18c996a to your computer and use it in GitHub Desktop.

Select an option

Save philgebhardt/5bfa712dd0c99f06263ce6c4a18c996a to your computer and use it in GitHub Desktop.
This DynamoDB client is configured for real-time processing
/*
* This dynamodb configuration is for real-time processing, which avoids spending too much time trying to
* connect to dynamodb -- failing quickly with a ClientExecutionTimeout if dynamo cannot be reached within 1 second
*/
public final AmazonDynamoDB getDynamoDBForRealTimeProcessing() {
return AmazonDynamoDBClientBuilder.standard()
.withRegion(this.regions)
.withClientConfiguration(new ClientConfiguration()
.withConnectionTimeout(500)
.withClientExecutionTimeout(1000)
// Allow as many retries as possible until the client execution timeout expires
.withMaxErrorRetry(Integer.MAX_VALUE))
.build();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment