You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Serge Merzliakov <sm...@epistatic.net> on 2009/06/26 01:21:56 UTC

Can a camel route be run as a batch (peridiocally) in ActiveMQ config

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.

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.


Re: Can a camel route be run as a batch (peridiocally) in ActiveMQ config

Posted by Serge Merzliakov <sm...@epistatic.net>.
Thanks for all the good links. I will follow them up
.
Serge


Claus Ibsen-2 wrote:
> 
> On Fri, Jun 26, 2009 at 1:21 AM, Serge Merzliakov<sm...@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
> 
> 

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


Re: Can a camel route be run as a batch (peridiocally) in ActiveMQ config

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jun 26, 2009 at 1:21 AM, Serge Merzliakov<sm...@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