Or use the timer component to send a message each 10 seconds to a processor. This processor could use a consumer template to poll the queue in a loop and send the message to another camel route with a producer template (using the direct component ). The consumer template also has a timeout parameter. You can use it to break out from the loop, if there is no message in the queue.
I think this is an easier - less sophisticated - solution. Best, Christian Am 27.08.2015 00:59 schrieb "Raul Kripalani" <[email protected]>: > Currently I think that we only support fixed schedules. So with the cron > scheduler you could achieve something like: start/resume the route on every > minute at 00 and 30 seconds, stop/suspend every minute at 10 and 40 seconds > time marks. > > This would effectively keep your route running for 10 seconds every 30 > seconds. > > If you want something more sophisticated, like stopping it once the queue > is empty, you would need to extend what we offer OOTB with your own logic. > > Maybe you want to stop the route when t be consumer has been inactive for 1 > second or 500ms, or when queue size is 0 at the broker (checking via JMX). > > Raúl. > On 26 Aug 2015 23:19, "gilboy" <[email protected]> wrote: > > > Thanks for the feedback. So just to confirm if I have the following route > > and > > I want to consume a message every 30 seconds would I inject in to the > route > > a RoutePolicy(e.g. SimpleScheduledRoutePolicy) where I specify the > > routeStartRepeatInterval(30 seconds). I feel like I am missing something. > > What shuts down the route etc > > > > from("jms:endpointDetails") > > .routeId("test") > > .routePolicy(policy) > > .to("mock:success"); > > > > Thanks > > Joe > > > > > > > > -- > > View this message in context: > > > http://camel.465427.n5.nabble.com/Getting-JMSConsumer-to-look-for-messages-every-N-seconds-tp5770986p5770997.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > >
