On Tue, Feb 16, 2010 at 11:20 AM, Kevin Jackson <[email protected]> wrote: > Hi Claus, > >> In the future we will add a scheduled DSL to Camel so you can schedule >> routes to be started using a nice DSL syntax which supports CRON and >> regular timer delays etc. If we had that in place your use case would >> be easy. > > That sounds great! Do you want a hand with the code, I'm happy to > contribute to something that we really need here. >
We love contributions. The problem is mostly that camel-core need to work with a CRON library of choice, such as quartz. So its probably a little work in camel-core to detect whether camel-quartz is in the classpath and being able to leverage some logic in there to create the quartz scheduler and have it fire a task based on the cron setting. Then that logic must work together with the ScheduledPollConsumer which is the stuff that currently is in use by ftp/file components etc. Maybe the CRON library should be pluggable so we can leverage Spring CRON in 3.0 and/or the new CRON library in ActiveMQ 5.4. I dont fancy writing a CRON library from beginning :) > Do you have any suggestions for a workaround I can use now until this > new DSL is available? > You could probably use a custom PollingConsumerPollStrategy and only return true in begin if the CRON job had recently fired. eg use some shared flag which you set to true from the CRON job, and then in the poll strategy you check this flag. And if it was true you can go ahead, and then set the flag to false. http://camel.apache.org/polling-consumer.html > I'm think we could just use the consumer.delay and > consumer.initialDelay to achieve nearly the same functionality but > with harder to read config. > > My only concern is > a daily schedule becomes consumer.deplay=86400000 - does the ftp > component use ints or longs to store the number of miliseconds... > Yeah they should be longs for millis private long initialDelay = 1000; private long delay = 500; There is also a timeunit private TimeUnit timeUnit = TimeUnit.MILLISECONDS; But that is not easily settable from endpoint URI > Thanks for the help so far, > > Kev > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
