Hello,
I am using Apache Camel 2.12 (Fuse 6.1).  I am trying to use the JPA
consumer to consume from a database at every given interval using a timer. 
I like to consume all of the records that match the search criteria using
the aggregator.  If the JPA consumer is a standalone route, I can use the
aggregate EIP as follows:

from ("jpa://com.cigna.upp.model.CustomerAccount?consumer.nativeQuery=" +       
"SELECT A, B, C, FROM MYTABLE WHERE CLNT_ACCT_NUM='5'" +        
"&consumeDelete=false" +                "&consumer.delay=6000" +        
"&consumer.resultClass=com.myapp.model.CustomerAccount")
.aggregate(constant(true), new GroupedExchangeAggregationStrategy())
.beanRef("jpaRouterHelper","processGroupedExchanges")
.setCompletionFromBatchConsumer(true)
Given the above route, I will get all records that match the search criteria
using the GroupedExchangeAggregationStrategy().  That is, by the time my
bean "jpaRouterHelper.processGroupedExchanges" is called, I can process all
of the Exchanges using the Exchange.GROUPED_EXCHANGE.

I would like to do the same within a pollEnrich.  But there is no way to
tell pollEnrich to set the setCompletionFromBatchConsumer() so that I will
get all of the record.  I can set a timeout on the .pollEnrich(resourceUri,
timeout, aggregationStrategy).  The following is the route that I have:

from ("timer://jpaTimer?fixedRate=true&period=10s")     .pollEnrich (   
"jpa://com.cigna.upp.model.CustomerAccount?consumer.nativeQuery=" +             
"SELECT A, B, C, FROM MYTABLE WHERE CLNT_ACCT_NUM='5'" +                
"&consumeDelete=false" +                
"&consumer.resultClass=com.myapp.model.CustomerAccount",                new
GroupedExchangeAggregationStrategy())
.beanRef("jpaRouterHelper","processGroupedExchanges")
How would I get all of the records using the pollEnrich using the completion
from batch consumer?  Or should I be approaching this differently?

Any help is greatly appreciated.

thanks,
sunil.



--
View this message in context: 
http://camel.465427.n5.nabble.com/PollEnrich-JPA-setCompletionFromBatchConsumer-aggregator-tp5775895.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to