I have a camel rest api which scans a DynamoDb table. The code is like so ->
.post("dynamodb-scan-table")
.route()
.toD("aws2-ddb://user?accessKey=insert&secretKey=insert®ion=us-east-1&operation=Scan")
.endRest();
This returns all the items in my table. My problem is how to scan the table based on a certain condition. In the camel docs , it is given that there is a header CamelAwsDdbScanFilter
which is of the type Map<String, Condition>
needs to be set in order to achieve the solution for my problem. I have a table of users and suppose I want to retrieve all the users with FirsName = Will
. How do I implement the Map<String, Condition>
in order to achieve this? Basically I am not sure what to put in the Condition
of the map.
You can find example usage in ScanCommandTest .
For condition FirstName
eq Will
the filter could be something like:
exchange.getIn().setHeader(DdbConstants.SCAN_FILTER, new HashMap<String, Condition>(){{
put("FirsName", new Condition()
.withComparisonOperator(ComparisonOperator.EQ)
.withAttributeValueList(new AttributeValue().withS("Will")));
}});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.