【发布时间】: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