camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-12118) DynamoDB: Execute query using secondary indexes
Date Wed, 03 Jan 2018 14:32:00 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-12118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309719#comment-16309719
] 

ASF GitHub Bot commented on CAMEL-12118:
----------------------------------------

oscerd closed pull request #2162: CAMEL-12118: DynamoDB: Execute query using secondary indexes
URL: https://github.com/apache/camel/pull/2162
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/components/camel-aws/src/main/docs/aws-ddb-component.adoc b/components/camel-aws/src/main/docs/aws-ddb-component.adoc
index 19544e99f5a..cc3145b922b 100644
--- a/components/camel-aws/src/main/docs/aws-ddb-component.adoc
+++ b/components/camel-aws/src/main/docs/aws-ddb-component.adoc
@@ -105,6 +105,8 @@ returned.
 |`CamelAwsDdbConsistentRead` |`Boolean` |If set to true, then a consistent read is issued,
otherwise eventually
 consistent is used.
 
+|`CamelAwsDdbIndexName` |`String` |If set will be used as Secondary Index for Query operation.
+
 |`CamelAwsDdbItem` |`Map<String, AttributeValue>` |A map of the attributes for the
item, and must include the primary key
 values that define the item.
 
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java
index 6c2dbaeed4d..6ababab2fd6 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java
@@ -32,6 +32,8 @@
     // String EXACT_COUNT = "CamelAwsDdbExactCount";
     // Removed from DynamoDB v1 to v2
     // String HASH_KEY_VALUE = "CamelAwsDdbHashKeyValue";
+    // Added INDEX_NAME for querying secondary indexes
+    String INDEX_NAME = "CamelAwsDdbIndexName";
     String ITEM = "CamelAwsDdbItem";
     String ITEMS = "CamelAwsDdbItems";
     String ITEM_COUNT = "CamelAwsDdbTableItemCount";
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
index 8719bfe5329..d64e9eeff6c 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
@@ -34,7 +34,7 @@ public QueryCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration,
Ex
 
     @Override
     public void execute() {
-        QueryResult result = ddbClient.query(new QueryRequest()
+        QueryRequest query = new QueryRequest()
                 .withTableName(determineTableName())
                 .withAttributesToGet(determineAttributeNames())
                 .withConsistentRead(determineConsistentRead())
@@ -42,7 +42,14 @@ public void execute() {
                 .withKeyConditions(determineKeyConditions())
                 .withExclusiveStartKey(determineStartKey())
                 .withLimit(determineLimit())
-                .withScanIndexForward(determineScanIndexForward()));
+                .withScanIndexForward(determineScanIndexForward());
+        
+        // Check if we have set an Index Name
+        if(exchange.getIn().getHeader(DdbConstants.INDEX_NAME, String.class) != null) {
+            query.withIndexName(exchange.getIn().getHeader(DdbConstants.INDEX_NAME, String.class));
+        }
+        
+        QueryResult result = ddbClient.query(query);
         
         Map tmp = new HashMap<>();
         tmp.put(DdbConstants.ITEMS, result.getItems());


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> DynamoDB: Execute query using secondary indexes
> -----------------------------------------------
>
>                 Key: CAMEL-12118
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12118
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-aws
>            Reporter: Fabrizio Spataro
>            Assignee: Fabrizio Spataro
>             Fix For: 2.21.0
>
>
> Current code isn't able to indicate a secondary index name into a query operation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message