On Mon, Sep 21, 2009 at 1:46 PM, Charles Moulliard <[email protected]> wrote: > The POJO defined in the following route consumes immediately messages > posted on a queue and in consequence is not triggered by the Quartz > timer > > <camel:from > uri="quartz://x3sReporting/clientError?cron=0+0/5+9-18+?+*+MON-FRI"/> > <camel:doTry> > <camel:bean ref="reportingConsumer" > method="collectMessages"/> > ... > > public class ReportingConsumer { > > �...@consume(ref = "queueReportingEndpoint") // = x3s:report queue > public List<Map<String, Object>> collectMessages(List<Map<String, > Object>> received) { > > List<Map<String, Object>> result = new ArrayList<Map<String, > Object>>(); > > if (received != null) { > > Log.info("Received exchange : " + received.size()); > for(Map<String, Object> model : received) { > > Log.info("Map received : " + model.toString()); > // Add model received into the result output > list > result.add( model ); > } > } > > return result; > } > > Question : How can I avoid that the bean consumes immediately messages > from the queue and wait quartz triggering ?
You cannot as @Consume(ref = "queueReportingEndpoint") has ABSOLUTELY nothing to do with quartz. It creates a new event driven consumer which listen on new messages arriving on that JMS queue. You can remove the @Consume and then let quartz invoke it from the Camel route. And then you can in your bean use a consumer template to read messages from the JMS queue. Now you bean is only invoked when quartz triggers. > > Charles Moulliard > Senior Enterprise Architect > Apache Camel Committer > > ***************************** > blog : http://cmoulliard.blogspot.com > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
