Using QuartzScheduledPollConsumerScheduler - 6.3

Talend ESB Mediation Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

The Quartz2 component provides a Polling Consumer scheduler which allows to use cron based scheduling for Polling Consumer such as the File and FTP consumers.

For example to use a cron based expression to poll for files every 2nd second, then a Camel route can be define simply as:

from("file:inbox?scheduler=quartz2&scheduler.cron=0/2+*+*+*+*+?")
   .to("bean:process");  

Notice we define the scheduler=quartz2 to instruct Camel to use the Quartz2 based scheduler. Then we use scheduler.xxx options to configure the scheduler. The Quartz2 scheduler requires the cron option to be set.

The following options is supported:

Parameter

Default

Type

Description

quartzScheduler

null

org.quartz.Scheduler

To use a custom Quartz scheduler. If none configure then the shared scheduler from the Quartz2 component is used.

cron

null

String

Mandatory: To define the cron expression for triggering the polls.

triggerId

null

String

To specify the trigger id. If none provided then an UUID is generated and used.

triggerGroup

QuartzScheduledPoll-

ConsumerScheduler

String

To specify the trigger group.

timeZone

Default

TimeZone

The time zone to use for the CRON trigger.

Important: Remember configuring these options from the endpoint URIs must be prefixed with scheduler..

For example to configure the trigger id and group:

from("file:inbox?scheduler=quartz2&scheduler.cron=0/2+*+*+*+*+?&scheduler.trigger
Id=myId&scheduler.triggerGroup=myGroup")
   .to("bean:process");

There is also a CRON scheduler in Spring, so you can use the following as well:

from("file:inbox?scheduler=spring&scheduler.cron=0/2+*+*+*+*+?")
   .to("bean:process");