kaleem ahmed created CAMEL-15205:
------------------------------------

             Summary: camel-quartz documentation for Cron is incorrect
                 Key: CAMEL-15205
                 URL: https://issues.apache.org/jira/browse/CAMEL-15205
             Project: Camel
          Issue Type: Improvement
          Components: camel-quartz
    Affects Versions: 3.3.0
            Reporter: kaleem ahmed


The current documentation says for cron job the spaces needs to replaced by +. 
However that does not seem to be the case as of the latest release. If you 
specify + instead of blank it throws a runtime error 

 
{quote}Caused by: java.lang.RuntimeException: CronExpression '#  0 1 6-18 ? * 
*' is invalid.Caused by: java.lang.RuntimeException: CronExpression '#  0 1 
6-18 ? * *' is invalid. at 
org.quartz.CronScheduleBuilder.cronSchedule(CronScheduleBuilder.java:111) at 
org.apache.camel.component.quartz.QuartzEndpoint.createTrigger(QuartzEndpoint.java:485)
 at 
org.apache.camel.component.quartz.QuartzEndpoint.addJobInScheduler(QuartzEndpoint.java:372)
 at 
org.apache.camel.component.quartz.QuartzEndpoint.doStart(QuartzEndpoint.java:328)
 at org.apache.camel.support.service.BaseService.start(BaseService.java:115) at 
org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:84)
 at org.apache.camel.impl.engine.RouteService.doWarmUp(RouteService.java:141) 
at org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:123) ... 
13 moreCaused by: java.text.ParseException: Unexpected character: # at 
org.quartz.CronExpression.storeExpressionVals(CronExpression.java:697) at 
org.quartz.CronExpression.buildExpression(CronExpression.java:487) at 
org.quartz.CronExpression.<init>(CronExpression.java:276) at 
org.quartz.CronScheduleBuilder.cronSchedule(CronScheduleBuilder.java:107) ... 
20 more
{quote}
The documentation is wrong  and it should be regular cron format all works 
well. 

 
{quote}The Bad:

from(quartz("myQuartz").cron("0+1+6-18+?+*+*")).to(mock("direct"))

The Good

from(quartz("myQuartz").cron("0 0 6,18 ? * *")).to(mock("direct"))
{quote}
 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to