camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Can a camel route be run as a batch (peridiocally) in ActiveMQ config
Date Fri, 26 Jun 2009 05:11:47 GMT
On Fri, Jun 26, 2009 at 1:21 AM, Serge Merzliakov<smerz@epistatic.net> wrote:
>
> Hello,
>   I have created a simple camel route which copies messages from one JMS
> queue to another. When I insert this into my activemq.xml config file it
> works fine.
>
>        <cm:camelContext id="camel">
>                <cm:route >
>                        <cm:from uri="jms:queue:input" />
>                        <cm:from uri="jms:queue:output" />
>                </cm:route>
>        </cm:camelContext>
>
>
> Is there a way of running this periodically, e.g. every 10 minutes?
>
> I know i can just run it from a simple java class and a script file (using
> Spring Application Context to start it up) and using cron/autosys/etc. I was
> hoping to be able to do this in the activemq config as it provides a single
> consistent way of handling the JMS infrastructure and message flows - i.e.
> one less moving part.

What you have above in the route is an event driven consumer
http://camel.apache.org/event-driven-consumer.html

It triggeres when an event occurs, such as a new jms message arrives.
As such scheduling this is not really easy as it kinda "listen all the time".

To have better control with this you can use polling consumer instead
http://camel.apache.org/polling-consumer.html

And you can combine this with the camel-quartz component to scheduled
using cron syntax
http://camel.apache.org/quartz.html

Or the regular JDK timer
http://camel.apache.org/timer

See the "timer based polling consumer" here
http://camel.apache.org/polling-consumer.html


>
> Regards,
> Serge
> --
> View this message in context: http://www.nabble.com/Can-a-camel-route-be-run-as-a-batch-%28peridiocally%29-in-ActiveMQ-config-tp24212596p24212596.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message