Shitfy
Shitfy

Reputation: 95

Scheduler and cron expression

How can I make route which will be use cron expression?

I mean I want to do something like this:

from("scheduler://foo?period=CRONEXPRESSION").to(SOME_BEAN);

Is it possible?

Upvotes: 1

Views: 1017

Answers (1)

burki
burki

Reputation: 7015

For simple scheduling cases, you can use the Camel Timer component that is part of camel-core and therefore does not need any other dependencies.

If you need to use a Cron expression, you can use the Camel Quartz component. For both versions you have to add a dependency.

Addition due to comment from Claus Ibsen

And there is also the Camel Scheduler component that is part of camel-core and able to handle Cron expressions. You can configure it to use Quartz2, Spring or your own scheduler (depending on it you have to add the dependency).

from("scheduler://foo?scheduler=quartz2&scheduler.cron=[your expression]")

There are examples and more information on the linked documentation pages.

Upvotes: 3

Related Questions