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 2020/01/07 08:08:30 UTC
[camel] branch camel-3.0.x updated: Camel-aws-ddb: Fix scan
operation. Limit and start key headers are properly read.
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch camel-3.0.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.0.x by this push:
new a97d56c Camel-aws-ddb: Fix scan operation. Limit and start key headers are properly read.
a97d56c is described below
commit a97d56c2c9b9cbe54248d0a4999bb2658728740f
Author: Scalzi <d_...@yahoo.com>
AuthorDate: Mon Jan 6 18:39:36 2020 -0500
Camel-aws-ddb: Fix scan operation.
Limit and start key headers are properly read.
---
.../org/apache/camel/component/aws/ddb/AbstractDdbCommand.java | 9 +++++++++
.../java/org/apache/camel/component/aws/ddb/QueryCommand.java | 4 ----
.../java/org/apache/camel/component/aws/ddb/ScanCommand.java | 2 ++
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java b/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java
index 02e8fa6..68315d5 100644
--- a/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java
+++ b/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java
@@ -93,4 +93,13 @@ public abstract class AbstractDdbCommand {
protected Boolean determineConsistentRead() {
return exchange.getIn().getHeader(DdbConstants.CONSISTENT_READ, configuration.isConsistentRead(), Boolean.class);
}
+
+ @SuppressWarnings("unchecked")
+ protected Map<String, AttributeValue> determineExclusiveStartKey() {
+ return exchange.getIn().getHeader(DdbConstants.START_KEY, Map.class);
+ }
+
+ protected Integer determineLimit() {
+ return exchange.getIn().getHeader(DdbConstants.LIMIT, Integer.class);
+ }
}
diff --git a/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java b/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
index dbeba63..e62ac1e 100644
--- a/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
+++ b/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
@@ -69,8 +69,4 @@ public class QueryCommand extends AbstractDdbCommand {
private Map determineKeyConditions() {
return exchange.getIn().getHeader(DdbConstants.KEY_CONDITIONS, Map.class);
}
-
- private Integer determineLimit() {
- return exchange.getIn().getHeader(DdbConstants.LIMIT, Integer.class);
- }
}
diff --git a/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java b/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java
index 672e8a4..aa09a7a 100644
--- a/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java
+++ b/components/camel-aws-ddb/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java
@@ -35,6 +35,8 @@ public class ScanCommand extends AbstractDdbCommand {
public void execute() {
ScanResult result = ddbClient.scan(new ScanRequest()
.withTableName(determineTableName())
+ .withLimit(determineLimit())
+ .withExclusiveStartKey(determineExclusiveStartKey())
.withScanFilter(determineScanFilter()));
Map tmp = new HashMap<>();