【问题标题】:Camel pollEnrich JPA ignoring namedQueryCamel pollEnrich JPA忽略namedQuery
【发布时间】:2019-01-26 00:13:32
【问题描述】:

使用 JPA Consumer、transform 和其他中间路线操作构建 Camel ETL 路线示例。这包括针对另一个 JPA 实体的附加 pollEnrich 步骤。 pollEnrich 步骤应该基于已定义的具有动态参数的 namedQuery 使用实体数据(通过先前交换的 #params 注册表映射传递)。它完全忽略了 namedQuery。它还会忽略任何内联查询 - 无论查询多么简单 - 并且只是将初始记录轮询到 maximumResults。

from("jpa:com.tcfbank.example.entity.PersonEntity?maxMessagesPerPoll=500&persistenceUnit=cedb&consumer.namedQuery=withOccupationCodeAndValidIdentification&consumer.initialDelay=3000&delay=3000&consumeDelete=false&consumeLockEntity=false")
.convertBodyTo(CanonicalPerson.class)
.to("bean:parameterManager")
.pollEnrich("jpa:com.tcfbank.example.entity.AccountEntity?persistenceUnit=cedb2&consumer.resultClass=com.tcfbank.example.entity.AccountEntity&consumer.namedQuery=byCustomerId&consumer.parameters=#params&consumeDelete=false&consumeLockEntity=false&maximumResults=50", 5000, "accountAggregationStrategy").id("EnrichWithAccounts")
.to("bean:scoringClient")
.setHeader(Exchange.FILE_NAME, el("${in.body.customerId}.xml"))
.to("file:target/customers");

【问题讨论】:

    标签: jpa apache-camel


    【解决方案1】:

    pollEnrich不是jpaconsumer而是pollingconsumer,去掉参数中的前缀consumer

    .pollEnrich("jpa:com.tcfbank.example.entity.AccountEntity?persistenceUnit=cedb2&<strike>consumer.</strike>resultClass=com.tcfbank.example.entity.AccountEntity&<strike>consumer.</strike>namedQuery=byCustomerId&<strike>consumer.</strike>parameters=#params&consumeDelete=false&consumeLockEntity=false&maximumResults=50", 5000, "accountAggregationStrategy").id("EnrichWithAccounts")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多