[英]How to scan a dynamodb table using apache camel?
I have a camel rest api which scans a DynamoDb table.我有一个扫描 DynamoDb 表的骆驼 rest api。 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.在骆驼文档中,有一个 header
CamelAwsDdbScanFilter
需要设置Map<String, Condition>
类型才能解决我的问题。 I have a table of users and suppose I want to retrieve all the users with FirsName = Will
.我有一个用户表,假设我想用
FirsName = Will
检索所有用户。 How do I implement the Map<String, Condition>
in order to achieve this?如何实现
Map<String, Condition>
以实现此目的? Basically I am not sure what to put in the Condition
of the map.基本上我不知道在 map 的
Condition
下放什么。
You can find example usage in ScanCommandTest .您可以在ScanCommandTest中找到示例用法。
For condition FirstName
eq Will
the filter could be something like:对于条件
FirstName
Will
过滤器可能类似于:
exchange.getIn().setHeader(DdbConstants.SCAN_FILTER, new HashMap<String, Condition>(){{
put("FirsName", new Condition()
.withComparisonOperator(ComparisonOperator.EQ)
.withAttributeValueList(new AttributeValue().withS("Will")));
}});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.