有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何使用apache camel扫描dynamodb表?

我有一个骆驼床。代码是这样的->

.post("dynamodb-scan-table")
   .route()
  .toD("aws2-ddb://user?accessKey=insert&secretKey=insert&region=us-east-1&operation=Scan")
  .endRest();

这将返回我的表中的所有项。我的问题是如何根据特定条件扫描表。在camel docs中,有一个头CamelAwsDdbScanFilter,它的类型是Map<String, Condition>需要设置的,以便实现我的问题的解决方案。我有一个用户表,假设我想用FirsName = Will检索所有用户。我如何实现Map<String, Condition>以实现这一点?基本上我不确定在地图的Condition中放什么


共 (1) 个答案

  1. # 1 楼答案

    你可以在ScanCommandTest中找到用法示例

    对于条件FirstNameeq Will,过滤器可能类似于:

    exchange.getIn().setHeader(DdbConstants.SCAN_FILTER, new HashMap<String, Condition>(){{
        put("FirsName", new Condition()
                .withComparisonOperator(ComparisonOperator.EQ)
                .withAttributeValueList(new AttributeValue().withS("Will")));
    }});