Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.

How do I specify time period in a human friendly syntax

Available as of Camel 2.3

Some of the Camel components offers options to specify a time period, which must be entered in milli second as unit. This may be unfriendly to read as a human when the value is large such as 45min = 2700000 millis.

So in Camel 2.3 you can now configure any endpoint uri parameter using a String syntax, which at runtime will get converted to millis (long type).

You can use the following short syntax, which is most common to use:

Syntax

Unit

h

hour

m

minute

s

second

So for example the Timer endpoint can be configured as follows

from("timer:foo?period=45m").to("log:foo");

You can mix and match the units so you can do this as well:

from("timer:foo?period=1h15m").to("log:foo");
from("timer:bar?period=2h30s").to("log:bar");
from("timer:bar?period=3h45m58s").to("log:bar");

However you can also use long syntax

Syntax

Unit

hour or hours

hour

minute or minutes

minute

second or seconds

second

from("timer:foo?period=45minutes").to("log:foo");
© 2004-2015 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram