Hi
I have updated the 2.0 design wiki page.
I think one of the main new features should be nice DSL support for schedule
polls. Currently in camel the consumer endpoints might support ScheduledPolls
but then its very basic timing (initial delay, delay, fixed/rate) using the
simple Timer scheduler in Java.
As end-users need to configure this on the endpoint directly usually in the
from route as:
from("file://dir?consumer.delay=60000").to("bean:processFile");
Since we have a mess with the options, as you need the "consumer." prefix thsat
confuses people. I would love to get rid of it so it was just as before (there
isn't a name clash anyway)
from("file://dir?delay=60000").to("bean:processFile");
However this DSL is very basic and not all consumer endpoints support this
scheduling - for instance iBatis, HTTP etc. It is actually not the
responsibility of the component to handle the scheduling. The consumer should
just run when it's invoked (receive()). However we need to support timeout
also. receive(), receiveNoWait() receive(Timeout);
So I propose to @deprecated or at least reduce the usage of
ScheduledPollConsumer. We should let the schedule be triggered elsewhere, (such
as the timer as now). But with build in nice DSL support.
schedule().every(5).minute().from("file://dir").to("bean:processFile")
And we could consider have a poll() syntax:
schedule().every(5).minute().poll("file://dir").to("bean:processFile")
We could consider allow ref for schedulers:
from(("file://dir?scheduler=pollFtpFiles").to("bean:processFile")
to allow the old from syntax but with nice spring configuration support.
<bean id="pollFtpFiles" class="org.apache...ScheduleBuilder">
<option name="delay" value="5"/>
<option name="unit" value="minute"/>
<option name="fixed" value="true "/>
<option name="initalDelay" value="10"/>
</bean>
However would be a little challenge to have nice names to allow easy
configuration that is easy for end-users to read and understand:
Later we can improve this builder syntax to allow cron like expression. Now we
need Hadrians pluggable DSL ;)
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk