Kiril Nugmanov created CAMEL-15951:
--------------------------------------
Summary: Introduce configuration property to skip DescribeTable
operation on start of aws2-ddb component
Key: CAMEL-15951
URL: https://issues.apache.org/jira/browse/CAMEL-15951
Project: Camel
Issue Type: New Feature
Components: camel-aws2
Affects Versions: 3.6.0
Reporter: Kiril Nugmanov
On {{aws2-ddb}} endpoint start it constantly checking table by doing
{{DescribeTable}} request.
{code}
@Override
public void doStart() throws Exception {
super.doStart();
ddbClient = configuration.getAmazonDDBClient() != null ?
configuration.getAmazonDDBClient() : createDdbClient();
String tableName = getConfiguration().getTableName();
LOG.trace("Querying whether table [{}] already exists...", tableName);
try {
DescribeTableRequest.Builder request =
DescribeTableRequest.builder().tableName(tableName);
TableDescription tableDescription =
ddbClient.describeTable(request.build()).table();
if (!isTableActive(tableDescription)) {
waitForTableToBecomeAvailable(tableName);
}
LOG.trace("Table [{}] already exists", tableName);
return;
} catch (ResourceNotFoundException e) {
LOG.trace("Table [{}] doesn't exist yet", tableName);
LOG.trace("Creating table [{}]...", tableName);
TableDescription tableDescription = createTable(tableName);
if (!isTableActive(tableDescription)) {
waitForTableToBecomeAvailable(tableName);
}
LOG.trace("Table [{}] created", tableName);
}
}
{code}
Key issues with such approach:
* it requires to grant {{DescribeTable}} operation for client which provides
sensitive information like KMS master key ARN/ID, billing information etc.
(https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html)
* after start and checking table status for being ACTIVE there is no guarantee
that it's actually true on doing any other DDB operation with started
component.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)