Forum Home » Fuse Distributions » Fuse ESB

Thread: Changing default poller behavior for JPA component

 
This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Sep 22, 2010 10:30 PM Last Post By: wspablo
wspablo

Posts: 4
Registered: 07/23/10
Changing default poller behavior for JPA component
Posted: Sep 20, 2010 4:47 PM
 
  Click to reply to this thread Reply
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" />
			<pollEnrich timeout="0"
				uri="jpa://dummy.Event?consumer.query=select e from Event e" strategyRef="myAggregationStrategy" id="pollenrich.jpa" />
			<to uri="log:out2" id="to.log2" />


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
davsclaus

Posts: 1,893
Registered: 10/14/08
Re: Changing default poller behavior for JPA component
Posted: Sep 21, 2010 9:27 AM   in response to: wspablo in response to: wspablo
 
  Click to reply to this thread Reply
Have you tried using enrich instead?

As an alternative you can always use plain JDBC, Spring JDBCTemplate or iBatis.
davsclaus

Posts: 1,893
Registered: 10/14/08
Re: Changing default poller behavior for JPA component
Posted: Sep 21, 2010 1:41 PM   in response to: davsclaus in response to: davsclaus
 
  Click to reply to this thread Reply
I created a ticket at Apache Camel
https://issues.apache.org/activemq/browse/CAMEL-3142

So the jpa consumer works better with pollEnrich.
wspablo

Posts: 4
Registered: 07/23/10
Re: Changing default poller behavior for JPA component
Posted: Sep 22, 2010 10:30 PM   in response to: davsclaus in response to: davsclaus
 
  Click to reply to this thread Reply
Thanks for the ticket. Using enrich instead pollEnrich doesn't work as the first one uses a producer instead a consumer

Regards