Try..catch updateTimeToLive in DynamoDbMetaDataSt
Related to https://github.com/spring-projects/spring-integration-aws/issues/90 The `dynamoDB.updateTimeToLive()` throws an exception if TTL is already enabled on the table * Wrap such a call to `try...catch()` and just log an error to let the application to proceed
This commit is contained in:
@@ -36,6 +36,7 @@ import com.amazonaws.services.dynamodbv2.document.Item;
|
||||
import com.amazonaws.services.dynamodbv2.document.Table;
|
||||
import com.amazonaws.services.dynamodbv2.document.spec.DeleteItemSpec;
|
||||
import com.amazonaws.services.dynamodbv2.document.spec.UpdateItemSpec;
|
||||
import com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException;
|
||||
import com.amazonaws.services.dynamodbv2.model.AttributeDefinition;
|
||||
import com.amazonaws.services.dynamodbv2.model.ConditionalCheckFailedException;
|
||||
import com.amazonaws.services.dynamodbv2.model.CreateTableRequest;
|
||||
@@ -213,7 +214,14 @@ public class DynamoDbMetaDataStore implements ConcurrentMetadataStore, Initializ
|
||||
.withAttributeName(TTL)
|
||||
.withEnabled(this.timeToLive > 0));
|
||||
|
||||
this.dynamoDB.updateTimeToLive(updateTimeToLiveRequest);
|
||||
try {
|
||||
this.dynamoDB.updateTimeToLive(updateTimeToLiveRequest);
|
||||
}
|
||||
catch (AmazonDynamoDBException e) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("The error during 'updateTimeToLive' request", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user