Reputation: 31
working up an example of Camel ETL route with JPA Consumer, transform and other mid-route operations. This includes an additional pollEnrich step against another JPA entity. the pollEnrich step is supposed to consume entity data based upon a defined namedQuery with dynamic parameters (passed via #params registry map from prior exchange). It ignores the namedQuery altogether. it also ignores any in-line query - no matter how simple the query - and simply polls the initial records up to 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");
Upvotes: 3
Views: 593
Reputation: 1
pollEnrich is not a jpaconsumer but a pollingconsumer, remove the prefix consumer from the parameters
.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")
Upvotes: -1