3 Replies Latest reply on Sep 22, 2010 6:30 PM by wspablo

    Changing default poller behavior for JPA component

    wspablo

      Hi there,

       

      I'm facing the following problem: I'd like to trigger a route by a message in a queue and then enrich it using a JPA consumer. According to the documentation I have,

       

      <from uri="activemq:queue:q.in.trigger" id="from.trigger" />
                     <to uri="log:out1" id="to.log"></to>
                     <pollEnrich timeout="0"
                          uri="jpa://dummy.Event?consumer.query=select e from Event e" strategyRef="myAggregationStrategy" id="pollenrich.jpa"></pollEnrich>
                     <to uri="log:out2" id="to.log2"></to>

       

      The problem is since the JPA is by default running as a scheduled poll consumer it hits the database on its own rate instead of every time the message arrive to the queue.

       

      I'm need this because I don't want to pull any data from the database before another route finish

       

      My question is: how do I change this behavior so I can pull from the database on demand instead on a schedule?

       

      I've already tried setting the timeout parameter to zero in the uri without luck, hope you can provide some ideas

       

      Regards