You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2026/01/08 14:05:00 UTC
(camel) 03/03: CAMEL-22829 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS DynamoDB
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch CAMEL-22805-part-2
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8df32657b8e7cd686672d0f45f18153f5a032bb1
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Jan 8 14:58:28 2026 +0100
CAMEL-22829 - Camel-AWS components: Avoid duplicated code and add pagination to producer operation where it makes sense - AWS DynamoDB
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../apache/camel/catalog/components/aws2-ddb.json | 41 ++++++-------
.../apache/camel/component/aws2/ddb/aws2-ddb.json | 41 ++++++-------
.../component/aws2/ddb/AbstractDdbCommand.java | 69 ++++++++++++++++++++++
.../camel/component/aws2/ddb/Ddb2Constants.java | 4 ++
.../camel/component/aws2/ddb/QueryCommand.java | 58 ++++++------------
.../camel/component/aws2/ddb/ScanCommand.java | 64 ++++++++++----------
.../aws2/ddbstream/Ddb2StreamConstants.java | 16 +++++
.../aws2/ddbstream/Ddb2StreamConsumer.java | 9 ++-
.../endpoint/dsl/Ddb2EndpointBuilderFactory.java | 13 ++++
9 files changed, 201 insertions(+), 114 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json
index 4a5cb9a705c6..25ed85cdf059 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json
@@ -70,26 +70,27 @@
"CamelAwsDdbKeyConditions": { "index": 13, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, Condition>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "This header specify the selection criteria for the query, and merge together the two old headers CamelAwsDdbHashKeyValue and CamelAwsDdbScanRangeKeyCondition", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Con [...]
"CamelAwsDdbKeySchema": { "index": 14, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "List<KeySchemaElement>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The KeySchema that identifies the primary key for this table. From Camel 2.16.0 the type of this header is List and not KeySchema", "constantName": "org.apache.camel.component.aws2.d [...]
"CamelAwsDdbLastEvaluatedKey": { "index": 15, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Key", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Primary key of the item where the query operation stopped, inclusive of the previous result set.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#LAST_EVALUATED_KEY" },
- "CamelAwsDdbLimit": { "index": 16, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The maximum number of items to return.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#LIMIT" },
- "CamelAwsDdbOperation": { "index": 17, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.aws2.ddb.Ddb2Operations", "enum": [ "BatchGetItems", "DeleteItem", "DeleteTable", "DescribeTable", "GetItem", "PutItem", "Query", "Scan", "UpdateItem", "UpdateTable" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform.", "constantName": "org.apac [...]
- "CamelAwsDdbProvisionedThroughput": { "index": 18, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughputDescription", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value of the ProvisionedThroughput property for this table", "constantName": "org.apache.camel.component.aws2 [...]
- "CamelAwsDdbReadCapacity": { "index": 19, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "ReadCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#READ_CAPACITY" },
- "CamelAwsDdbReturnValues": { "index": 20, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Use this parameter if you want to get the attribute name-value pairs before or after they are modified(NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW).", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#RETURN_VALUES" },
- "CamelAwsDdbScannedCount": { "index": 21, "kind": "header", "displayName": "", "group": "Scan", "label": "Scan", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Number of items in the complete scan before any filters are applied.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCANNED_COUNT" },
- "CamelAwsDdbScanIndexForward": { "index": 22, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Specifies forward or backward traversal of the index.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCAN_INDEX_FORWARD" },
- "CamelAwsDdbScanFilter": { "index": 23, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, Condition>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Evaluates the scan results and returns only the desired values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCAN_FILTER" },
- "CamelAwsDdbStartKey": { "index": 24, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, AttributeValue>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Primary key of the item from which to continue an earlier query.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#START_KEY" },
- "CamelAwsDdbTableName": { "index": 25, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Table Name for this operation.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_NAME" },
- "CamelAwsDdbTableSize": { "index": 26, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The table size in bytes.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_SIZE" },
- "CamelAwsDdbTableStatus": { "index": 27, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The status of the table: CREATING, UPDATING, DELETING, ACTIVE", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_STATUS" },
- "CamelAwsDdbUpdateCondition": { "index": 28, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, ExpectedAttributeValue>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Designates an attribute for a conditional modification.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_CONDITION" },
- "CamelAwsDdbUpdateValues": { "index": 29, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, AttributeValueUpdate>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Map of attribute name to the new value and action for the update.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_VALUES" },
- "CamelAwsDdbUnprocessedKeys": { "index": 30, "kind": "header", "displayName": "", "group": "BatchGetItems", "label": "BatchGetItems", "required": false, "javaType": "Map<String,KeysAndAttributes>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Contains a map of tables and their respective keys that were not processed with the current response.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UNPROCESSED_KEYS" },
- "CamelAwsDdbWriteCapacity": { "index": 31, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "WriteCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#WRITE_CAPACITY" },
- "CamelAwsDdbFilterExpression": { "index": 32, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION" },
- "CamelAwsDdbFilterExpressionAttributeNames": { "index": 33, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Names.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_NAMES" },
- "CamelAwsDdbFilterExpressionAttributeValues": { "index": 34, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_VALUES" },
- "CamelAwsDdbProjectExpression": { "index": 35, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Project Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#PROJECT_EXPRESSION" }
+ "CamelAwsDdbIsTruncated": { "index": 16, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated). If true, use LAST_EVALUATED_KEY as START_KEY for the next page.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#IS_TRUNCATED" },
+ "CamelAwsDdbLimit": { "index": 17, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The maximum number of items to return.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#LIMIT" },
+ "CamelAwsDdbOperation": { "index": 18, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.aws2.ddb.Ddb2Operations", "enum": [ "BatchGetItems", "DeleteItem", "DeleteTable", "DescribeTable", "GetItem", "PutItem", "Query", "Scan", "UpdateItem", "UpdateTable" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform.", "constantName": "org.apac [...]
+ "CamelAwsDdbProvisionedThroughput": { "index": 19, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughputDescription", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value of the ProvisionedThroughput property for this table", "constantName": "org.apache.camel.component.aws2 [...]
+ "CamelAwsDdbReadCapacity": { "index": 20, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "ReadCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#READ_CAPACITY" },
+ "CamelAwsDdbReturnValues": { "index": 21, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Use this parameter if you want to get the attribute name-value pairs before or after they are modified(NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW).", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#RETURN_VALUES" },
+ "CamelAwsDdbScannedCount": { "index": 22, "kind": "header", "displayName": "", "group": "Scan", "label": "Scan", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Number of items in the complete scan before any filters are applied.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCANNED_COUNT" },
+ "CamelAwsDdbScanIndexForward": { "index": 23, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Specifies forward or backward traversal of the index.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCAN_INDEX_FORWARD" },
+ "CamelAwsDdbScanFilter": { "index": 24, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, Condition>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Evaluates the scan results and returns only the desired values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCAN_FILTER" },
+ "CamelAwsDdbStartKey": { "index": 25, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, AttributeValue>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Primary key of the item from which to continue an earlier query.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#START_KEY" },
+ "CamelAwsDdbTableName": { "index": 26, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Table Name for this operation.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_NAME" },
+ "CamelAwsDdbTableSize": { "index": 27, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The table size in bytes.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_SIZE" },
+ "CamelAwsDdbTableStatus": { "index": 28, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The status of the table: CREATING, UPDATING, DELETING, ACTIVE", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_STATUS" },
+ "CamelAwsDdbUpdateCondition": { "index": 29, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, ExpectedAttributeValue>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Designates an attribute for a conditional modification.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_CONDITION" },
+ "CamelAwsDdbUpdateValues": { "index": 30, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, AttributeValueUpdate>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Map of attribute name to the new value and action for the update.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_VALUES" },
+ "CamelAwsDdbUnprocessedKeys": { "index": 31, "kind": "header", "displayName": "", "group": "BatchGetItems", "label": "BatchGetItems", "required": false, "javaType": "Map<String,KeysAndAttributes>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Contains a map of tables and their respective keys that were not processed with the current response.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UNPROCESSED_KEYS" },
+ "CamelAwsDdbWriteCapacity": { "index": 32, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "WriteCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#WRITE_CAPACITY" },
+ "CamelAwsDdbFilterExpression": { "index": 33, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION" },
+ "CamelAwsDdbFilterExpressionAttributeNames": { "index": 34, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Names.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_NAMES" },
+ "CamelAwsDdbFilterExpressionAttributeValues": { "index": 35, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_VALUES" },
+ "CamelAwsDdbProjectExpression": { "index": 36, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Project Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#PROJECT_EXPRESSION" }
},
"properties": {
"tableName": { "index": 0, "kind": "path", "displayName": "Table Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The name of the table currently worked with." },
diff --git a/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json b/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json
index 4a5cb9a705c6..25ed85cdf059 100644
--- a/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json
+++ b/components/camel-aws/camel-aws2-ddb/src/generated/resources/META-INF/org/apache/camel/component/aws2/ddb/aws2-ddb.json
@@ -70,26 +70,27 @@
"CamelAwsDdbKeyConditions": { "index": 13, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, Condition>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "This header specify the selection criteria for the query, and merge together the two old headers CamelAwsDdbHashKeyValue and CamelAwsDdbScanRangeKeyCondition", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Con [...]
"CamelAwsDdbKeySchema": { "index": 14, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "List<KeySchemaElement>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The KeySchema that identifies the primary key for this table. From Camel 2.16.0 the type of this header is List and not KeySchema", "constantName": "org.apache.camel.component.aws2.d [...]
"CamelAwsDdbLastEvaluatedKey": { "index": 15, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Key", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Primary key of the item where the query operation stopped, inclusive of the previous result set.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#LAST_EVALUATED_KEY" },
- "CamelAwsDdbLimit": { "index": 16, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The maximum number of items to return.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#LIMIT" },
- "CamelAwsDdbOperation": { "index": 17, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.aws2.ddb.Ddb2Operations", "enum": [ "BatchGetItems", "DeleteItem", "DeleteTable", "DescribeTable", "GetItem", "PutItem", "Query", "Scan", "UpdateItem", "UpdateTable" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform.", "constantName": "org.apac [...]
- "CamelAwsDdbProvisionedThroughput": { "index": 18, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughputDescription", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value of the ProvisionedThroughput property for this table", "constantName": "org.apache.camel.component.aws2 [...]
- "CamelAwsDdbReadCapacity": { "index": 19, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "ReadCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#READ_CAPACITY" },
- "CamelAwsDdbReturnValues": { "index": 20, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Use this parameter if you want to get the attribute name-value pairs before or after they are modified(NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW).", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#RETURN_VALUES" },
- "CamelAwsDdbScannedCount": { "index": 21, "kind": "header", "displayName": "", "group": "Scan", "label": "Scan", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Number of items in the complete scan before any filters are applied.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCANNED_COUNT" },
- "CamelAwsDdbScanIndexForward": { "index": 22, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Specifies forward or backward traversal of the index.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCAN_INDEX_FORWARD" },
- "CamelAwsDdbScanFilter": { "index": 23, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, Condition>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Evaluates the scan results and returns only the desired values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCAN_FILTER" },
- "CamelAwsDdbStartKey": { "index": 24, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, AttributeValue>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Primary key of the item from which to continue an earlier query.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#START_KEY" },
- "CamelAwsDdbTableName": { "index": 25, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Table Name for this operation.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_NAME" },
- "CamelAwsDdbTableSize": { "index": 26, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The table size in bytes.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_SIZE" },
- "CamelAwsDdbTableStatus": { "index": 27, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The status of the table: CREATING, UPDATING, DELETING, ACTIVE", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_STATUS" },
- "CamelAwsDdbUpdateCondition": { "index": 28, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, ExpectedAttributeValue>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Designates an attribute for a conditional modification.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_CONDITION" },
- "CamelAwsDdbUpdateValues": { "index": 29, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, AttributeValueUpdate>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Map of attribute name to the new value and action for the update.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_VALUES" },
- "CamelAwsDdbUnprocessedKeys": { "index": 30, "kind": "header", "displayName": "", "group": "BatchGetItems", "label": "BatchGetItems", "required": false, "javaType": "Map<String,KeysAndAttributes>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Contains a map of tables and their respective keys that were not processed with the current response.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UNPROCESSED_KEYS" },
- "CamelAwsDdbWriteCapacity": { "index": 31, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "WriteCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#WRITE_CAPACITY" },
- "CamelAwsDdbFilterExpression": { "index": 32, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION" },
- "CamelAwsDdbFilterExpressionAttributeNames": { "index": 33, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Names.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_NAMES" },
- "CamelAwsDdbFilterExpressionAttributeValues": { "index": 34, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_VALUES" },
- "CamelAwsDdbProjectExpression": { "index": 35, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Project Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#PROJECT_EXPRESSION" }
+ "CamelAwsDdbIsTruncated": { "index": 16, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the response has more results (is truncated). If true, use LAST_EVALUATED_KEY as START_KEY for the next page.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#IS_TRUNCATED" },
+ "CamelAwsDdbLimit": { "index": 17, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The maximum number of items to return.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#LIMIT" },
+ "CamelAwsDdbOperation": { "index": 18, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.aws2.ddb.Ddb2Operations", "enum": [ "BatchGetItems", "DeleteItem", "DeleteTable", "DescribeTable", "GetItem", "PutItem", "Query", "Scan", "UpdateItem", "UpdateTable" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform.", "constantName": "org.apac [...]
+ "CamelAwsDdbProvisionedThroughput": { "index": 19, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughputDescription", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value of the ProvisionedThroughput property for this table", "constantName": "org.apache.camel.component.aws2 [...]
+ "CamelAwsDdbReadCapacity": { "index": 20, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "ReadCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#READ_CAPACITY" },
+ "CamelAwsDdbReturnValues": { "index": 21, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Use this parameter if you want to get the attribute name-value pairs before or after they are modified(NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW).", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#RETURN_VALUES" },
+ "CamelAwsDdbScannedCount": { "index": 22, "kind": "header", "displayName": "", "group": "Scan", "label": "Scan", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Number of items in the complete scan before any filters are applied.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCANNED_COUNT" },
+ "CamelAwsDdbScanIndexForward": { "index": 23, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Specifies forward or backward traversal of the index.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCAN_INDEX_FORWARD" },
+ "CamelAwsDdbScanFilter": { "index": 24, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, Condition>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Evaluates the scan results and returns only the desired values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#SCAN_FILTER" },
+ "CamelAwsDdbStartKey": { "index": 25, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, AttributeValue>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Primary key of the item from which to continue an earlier query.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#START_KEY" },
+ "CamelAwsDdbTableName": { "index": 26, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Table Name for this operation.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_NAME" },
+ "CamelAwsDdbTableSize": { "index": 27, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The table size in bytes.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_SIZE" },
+ "CamelAwsDdbTableStatus": { "index": 28, "kind": "header", "displayName": "", "group": "DeleteTable DescribeTable", "label": "DeleteTable DescribeTable", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The status of the table: CREATING, UPDATING, DELETING, ACTIVE", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#TABLE_STATUS" },
+ "CamelAwsDdbUpdateCondition": { "index": 29, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, ExpectedAttributeValue>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Designates an attribute for a conditional modification.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_CONDITION" },
+ "CamelAwsDdbUpdateValues": { "index": 30, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, AttributeValueUpdate>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Map of attribute name to the new value and action for the update.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UPDATE_VALUES" },
+ "CamelAwsDdbUnprocessedKeys": { "index": 31, "kind": "header", "displayName": "", "group": "BatchGetItems", "label": "BatchGetItems", "required": false, "javaType": "Map<String,KeysAndAttributes>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Contains a map of tables and their respective keys that were not processed with the current response.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#UNPROCESSED_KEYS" },
+ "CamelAwsDdbWriteCapacity": { "index": 32, "kind": "header", "displayName": "", "group": "UpdateTable DescribeTable", "label": "UpdateTable DescribeTable", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "WriteCapacityUnits property of this table.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#WRITE_CAPACITY" },
+ "CamelAwsDdbFilterExpression": { "index": 33, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION" },
+ "CamelAwsDdbFilterExpressionAttributeNames": { "index": 34, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Names.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_NAMES" },
+ "CamelAwsDdbFilterExpressionAttributeValues": { "index": 35, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Filter Expression Attribute Values.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#FILTER_EXPRESSION_ATTRIBUTE_VALUES" },
+ "CamelAwsDdbProjectExpression": { "index": 36, "kind": "header", "displayName": "", "group": "Query Scan", "label": "Query Scan", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Project Expression.", "constantName": "org.apache.camel.component.aws2.ddb.Ddb2Constants#PROJECT_EXPRESSION" }
},
"properties": {
"tableName": { "index": 0, "kind": "path", "displayName": "Table Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The name of the table currently worked with." },
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/AbstractDdbCommand.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/AbstractDdbCommand.java
index 2dd3f967d6f9..b21b64b138af 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/AbstractDdbCommand.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/AbstractDdbCommand.java
@@ -96,4 +96,73 @@ public abstract class AbstractDdbCommand {
protected Integer determineLimit() {
return exchange.getIn().getHeader(Ddb2Constants.LIMIT, Integer.class);
}
+
+ /**
+ * Gets the filter expression from the exchange header.
+ */
+ protected String determineFilterExpression() {
+ return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION, String.class);
+ }
+
+ /**
+ * Gets the filter expression attribute names from the exchange header.
+ */
+ @SuppressWarnings("unchecked")
+ protected Map<String, String> determineFilterExpressionAttributeNames() {
+ return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES, Map.class);
+ }
+
+ /**
+ * Gets the filter expression attribute values from the exchange header.
+ */
+ @SuppressWarnings("unchecked")
+ protected Map<String, AttributeValue> determineFilterExpressionAttributeValues() {
+ return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES, Map.class);
+ }
+
+ /**
+ * Gets the projection expression from the exchange header.
+ */
+ protected String determineProjectExpression() {
+ return exchange.getIn().getHeader(Ddb2Constants.PROJECT_EXPRESSION, String.class);
+ }
+
+ /**
+ * Gets the index name from the exchange header.
+ */
+ protected String determineIndexName() {
+ return exchange.getIn().getHeader(Ddb2Constants.INDEX_NAME, String.class);
+ }
+
+ /**
+ * Checks if the filter expression is set and not empty.
+ */
+ protected boolean hasFilterExpression() {
+ String filterExpression = exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION, String.class);
+ return filterExpression != null && !filterExpression.isEmpty();
+ }
+
+ /**
+ * Checks if the filter expression attribute names are set and not empty.
+ */
+ protected boolean hasFilterExpressionAttributeNames() {
+ Map<?, ?> names = exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES, Map.class);
+ return names != null && !names.isEmpty();
+ }
+
+ /**
+ * Checks if the filter expression attribute values are set and not empty.
+ */
+ protected boolean hasFilterExpressionAttributeValues() {
+ Map<?, ?> values = exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES, Map.class);
+ return values != null && !values.isEmpty();
+ }
+
+ /**
+ * Checks if the projection expression is set and not empty.
+ */
+ protected boolean hasProjectExpression() {
+ String projectExpression = exchange.getIn().getHeader(Ddb2Constants.PROJECT_EXPRESSION, String.class);
+ return projectExpression != null && !projectExpression.isEmpty();
+ }
}
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Constants.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Constants.java
index 6521c8c5ec5e..36cc035a252e 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Constants.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Constants.java
@@ -88,6 +88,10 @@ public interface Ddb2Constants {
"the previous result set.",
javaType = "Key")
String LAST_EVALUATED_KEY = "CamelAwsDdbLastEvaluatedKey";
+ @Metadata(label = "Query Scan",
+ description = "Whether the response has more results (is truncated). If true, use LAST_EVALUATED_KEY as START_KEY for the next page.",
+ javaType = "Boolean")
+ String IS_TRUNCATED = "CamelAwsDdbIsTruncated";
@Metadata(description = "The maximum number of items to return.", javaType = "Integer")
String LIMIT = "CamelAwsDdbLimit";
@Metadata(description = "The operation to perform.", javaType = "org.apache.camel.component.aws2.ddb.Ddb2Operations")
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/QueryCommand.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/QueryCommand.java
index 8ab32e8b28bc..b4b45e476704 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/QueryCommand.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/QueryCommand.java
@@ -22,7 +22,6 @@ import java.util.Map;
import org.apache.camel.Exchange;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
-import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import software.amazon.awssdk.services.dynamodb.model.Condition;
import software.amazon.awssdk.services.dynamodb.model.QueryRequest;
import software.amazon.awssdk.services.dynamodb.model.QueryResponse;
@@ -35,39 +34,39 @@ public class QueryCommand extends AbstractDdbCommand {
@Override
public void execute() {
- QueryRequest.Builder query = QueryRequest.builder().tableName(determineTableName())
- .attributesToGet(determineAttributeNames()).consistentRead(determineConsistentRead())
- .keyConditions(determineKeyConditions()).exclusiveStartKey(determineExclusiveStartKey())
- .limit(determineLimit()).scanIndexForward(determineScanIndexForward());
+ QueryRequest.Builder query = QueryRequest.builder()
+ .tableName(determineTableName())
+ .consistentRead(determineConsistentRead())
+ .keyConditions(determineKeyConditions())
+ .exclusiveStartKey(determineExclusiveStartKey())
+ .limit(determineLimit())
+ .scanIndexForward(determineScanIndexForward());
// Check if we have set an Index Name
- if (exchange.getIn().getHeader(Ddb2Constants.INDEX_NAME, String.class) != null) {
- query.indexName(exchange.getIn().getHeader(Ddb2Constants.INDEX_NAME, String.class));
+ String indexName = determineIndexName();
+ if (indexName != null) {
+ query.indexName(indexName);
}
- //skip adding attribute-to-get from 'CamelAwsDdbAttributeNames' if the header is null or empty list.
- if (exchange.getIn().getHeader(Ddb2Constants.ATTRIBUTE_NAMES) != null &&
- !exchange.getIn().getHeader(Ddb2Constants.ATTRIBUTE_NAMES, Collection.class).isEmpty()) {
- query.attributesToGet(determineAttributeNames());
+ // Skip adding attribute-to-get from 'CamelAwsDdbAttributeNames' if the header is null or empty list.
+ Collection<String> attributeNames = determineAttributeNames();
+ if (attributeNames != null && !attributeNames.isEmpty()) {
+ query.attributesToGet(attributeNames);
}
- if (exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION) != null &&
- !exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION, String.class).isEmpty()) {
+ if (hasFilterExpression()) {
query.filterExpression(determineFilterExpression());
}
- if (exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES) != null &&
- !exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES, Map.class).isEmpty()) {
+ if (hasFilterExpressionAttributeNames()) {
query.expressionAttributeNames(determineFilterExpressionAttributeNames());
}
- if (exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES) != null &&
- !exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES, Map.class).isEmpty()) {
+ if (hasFilterExpressionAttributeValues()) {
query.expressionAttributeValues(determineFilterExpressionAttributeValues());
}
- if (exchange.getIn().getHeader(Ddb2Constants.PROJECT_EXPRESSION) != null &&
- !exchange.getIn().getHeader(Ddb2Constants.PROJECT_EXPRESSION, Map.class).isEmpty()) {
+ if (hasProjectExpression()) {
query.projectionExpression(determineProjectExpression());
}
@@ -76,6 +75,7 @@ public class QueryCommand extends AbstractDdbCommand {
Map<Object, Object> tmp = new HashMap<>();
tmp.put(Ddb2Constants.ITEMS, result.items());
tmp.put(Ddb2Constants.LAST_EVALUATED_KEY, result.hasLastEvaluatedKey() ? result.lastEvaluatedKey() : null);
+ tmp.put(Ddb2Constants.IS_TRUNCATED, result.hasLastEvaluatedKey());
tmp.put(Ddb2Constants.CONSUMED_CAPACITY, result.consumedCapacity());
tmp.put(Ddb2Constants.COUNT, result.count());
addToResults(tmp);
@@ -89,24 +89,4 @@ public class QueryCommand extends AbstractDdbCommand {
private Map<String, Condition> determineKeyConditions() {
return exchange.getIn().getHeader(Ddb2Constants.KEY_CONDITIONS, Map.class);
}
-
- @SuppressWarnings("unchecked")
- private String determineFilterExpression() {
- return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION, String.class);
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, String> determineFilterExpressionAttributeNames() {
- return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES, Map.class);
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, AttributeValue> determineFilterExpressionAttributeValues() {
- return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES, Map.class);
- }
-
- @SuppressWarnings("unchecked")
- private String determineProjectExpression() {
- return exchange.getIn().getHeader(Ddb2Constants.PROJECT_EXPRESSION, String.class);
- }
}
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java
index 98999342f83d..2242e299ec6f 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/ScanCommand.java
@@ -16,13 +16,11 @@
*/
package org.apache.camel.component.aws2.ddb;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.apache.camel.Exchange;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
-import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import software.amazon.awssdk.services.dynamodb.model.Condition;
import software.amazon.awssdk.services.dynamodb.model.ScanRequest;
import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
@@ -35,18 +33,41 @@ public class ScanCommand extends AbstractDdbCommand {
@Override
public void execute() {
- ScanResponse result = ddbClient.scan(ScanRequest.builder().tableName(determineTableName()).limit(determineLimit())
+ ScanRequest.Builder scan = ScanRequest.builder()
+ .tableName(determineTableName())
+ .limit(determineLimit())
.exclusiveStartKey(determineExclusiveStartKey())
- .attributesToGet(determineAttributesToGet())
- .filterExpression(determineFilterExpression())
- .expressionAttributeNames(determineFilterExpressionAttributeNames())
- .expressionAttributeValues(determineFilterExpressionAttributeValues())
- .projectionExpression(determineProjectExpression())
- .scanFilter(determineScanFilter()).build());
+ .attributesToGet(determineAttributeNames())
+ .scanFilter(determineScanFilter());
+
+ // Check if we have set an Index Name
+ String indexName = determineIndexName();
+ if (indexName != null) {
+ scan.indexName(indexName);
+ }
+
+ if (hasFilterExpression()) {
+ scan.filterExpression(determineFilterExpression());
+ }
+
+ if (hasFilterExpressionAttributeNames()) {
+ scan.expressionAttributeNames(determineFilterExpressionAttributeNames());
+ }
+
+ if (hasFilterExpressionAttributeValues()) {
+ scan.expressionAttributeValues(determineFilterExpressionAttributeValues());
+ }
+
+ if (hasProjectExpression()) {
+ scan.projectionExpression(determineProjectExpression());
+ }
+
+ ScanResponse result = ddbClient.scan(scan.build());
Map<Object, Object> tmp = new HashMap<>();
tmp.put(Ddb2Constants.ITEMS, result.items());
tmp.put(Ddb2Constants.LAST_EVALUATED_KEY, result.hasLastEvaluatedKey() ? result.lastEvaluatedKey() : null);
+ tmp.put(Ddb2Constants.IS_TRUNCATED, result.hasLastEvaluatedKey());
tmp.put(Ddb2Constants.CONSUMED_CAPACITY, result.consumedCapacity());
tmp.put(Ddb2Constants.COUNT, result.count());
tmp.put(Ddb2Constants.SCANNED_COUNT, result.scannedCount());
@@ -57,29 +78,4 @@ public class ScanCommand extends AbstractDdbCommand {
private Map<String, Condition> determineScanFilter() {
return exchange.getIn().getHeader(Ddb2Constants.SCAN_FILTER, Map.class);
}
-
- @SuppressWarnings("unchecked")
- private Collection<String> determineAttributesToGet() {
- return exchange.getIn().getHeader(Ddb2Constants.ATTRIBUTE_NAMES, Collection.class);
- }
-
- @SuppressWarnings("unchecked")
- private String determineFilterExpression() {
- return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION, String.class);
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, String> determineFilterExpressionAttributeNames() {
- return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_NAMES, Map.class);
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, AttributeValue> determineFilterExpressionAttributeValues() {
- return exchange.getIn().getHeader(Ddb2Constants.FILTER_EXPRESSION_ATTRIBUTE_VALUES, Map.class);
- }
-
- @SuppressWarnings("unchecked")
- private String determineProjectExpression() {
- return exchange.getIn().getHeader(Ddb2Constants.PROJECT_EXPRESSION, String.class);
- }
}
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConstants.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConstants.java
index 74dd4a682020..44be65c57a6a 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConstants.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConstants.java
@@ -30,4 +30,20 @@ public interface Ddb2StreamConstants {
description = "A globally unique identifier for the event that was recorded in this stream record.",
javaType = "String")
String EVENT_ID = "CamelAwsDdbStreamEventId";
+ @Metadata(label = "consumer",
+ description = "The type of data modification that was performed on the DynamoDB table (INSERT, MODIFY, REMOVE).",
+ javaType = "String")
+ String EVENT_NAME = "CamelAwsDdbStreamEventName";
+ @Metadata(label = "consumer",
+ description = "The sequence number of the stream record.",
+ javaType = "String")
+ String SEQUENCE_NUMBER = "CamelAwsDdbStreamSequenceNumber";
+ @Metadata(label = "consumer",
+ description = "The approximate date and time when the stream record was created.",
+ javaType = "java.time.Instant")
+ String APPROXIMATE_CREATION_DATE_TIME = "CamelAwsDdbStreamApproximateCreationDateTime";
+ @Metadata(label = "consumer",
+ description = "The size of the stream record, in bytes.",
+ javaType = "Long")
+ String SIZE_BYTES = "CamelAwsDdbStreamSizeBytes";
}
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConsumer.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConsumer.java
index 19c0e184af83..f4906d6a1530 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConsumer.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddbstream/Ddb2StreamConsumer.java
@@ -58,7 +58,7 @@ public class Ddb2StreamConsumer extends ScheduledBatchPollingConsumer {
Map<String, String> shardIterators = shardIteratorHandler.getShardIterators();
- // okay we have some response from azure so lets mark the consumer as ready
+ // okay we have some response from DynamoDB Streams so lets mark the consumer as ready
forceConsumerAsReady();
for (Entry<String, String> shardIteratorEntry : shardIterators.entrySet()) {
@@ -129,6 +129,13 @@ public class Ddb2StreamConsumer extends ScheduledBatchPollingConsumer {
ex.getMessage().setBody(record, Record.class);
ex.getMessage().setHeader(Ddb2StreamConstants.EVENT_SOURCE, record.eventSource());
ex.getMessage().setHeader(Ddb2StreamConstants.EVENT_ID, record.eventID());
+ ex.getMessage().setHeader(Ddb2StreamConstants.EVENT_NAME, record.eventNameAsString());
+ if (record.dynamodb() != null) {
+ ex.getMessage().setHeader(Ddb2StreamConstants.SEQUENCE_NUMBER, record.dynamodb().sequenceNumber());
+ ex.getMessage().setHeader(Ddb2StreamConstants.APPROXIMATE_CREATION_DATE_TIME,
+ record.dynamodb().approximateCreationDateTime());
+ ex.getMessage().setHeader(Ddb2StreamConstants.SIZE_BYTES, record.dynamodb().sizeBytes());
+ }
return ex;
}
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java
index 287aea319a04..f96a2a52bb1d 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java
@@ -933,6 +933,19 @@ public interface Ddb2EndpointBuilderFactory {
public String awsDdbLastEvaluatedKey() {
return "CamelAwsDdbLastEvaluatedKey";
}
+ /**
+ * Whether the response has more results (is truncated). If true, use
+ * LAST_EVALUATED_KEY as START_KEY for the next page.
+ *
+ * The option is a: {@code Boolean} type.
+ *
+ * Group: Query Scan
+ *
+ * @return the name of the header {@code AwsDdbIsTruncated}.
+ */
+ public String awsDdbIsTruncated() {
+ return "CamelAwsDdbIsTruncated";
+ }
/**
* The maximum number of items to return.
*