Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1DBFC160C18 for ; Wed, 3 Jan 2018 15:32:03 +0100 (CET) Received: (qmail 99792 invoked by uid 500); 3 Jan 2018 14:32:03 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 99782 invoked by uid 99); 3 Jan 2018 14:32:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jan 2018 14:32:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id D4D5C1806FC for ; Wed, 3 Jan 2018 14:32:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -107.211 X-Spam-Level: X-Spam-Status: No, score=-107.211 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 2_3xsVSx9Dos for ; Wed, 3 Jan 2018 14:32:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 39F995FB9F for ; Wed, 3 Jan 2018 14:32:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A7A48E0D73 for ; Wed, 3 Jan 2018 14:32:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4E2B4240EE for ; Wed, 3 Jan 2018 14:32:00 +0000 (UTC) Date: Wed, 3 Jan 2018 14:32:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-12118) DynamoDB: Execute query using secondary indexes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 03 Jan 2018 14:32:04 -0000 [ 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` |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)