Contact Us 1-800-596-4880

Poll Scheduler

By default, Poll Scopes in Mule are set to poll a resource every 1000 milliseconds for new data. At times, you may wish to adjust the default polling interval, or configure the polling schedule to follow a more complex logic.

This document offers details on how to configure a polling schedule via two methods made available in Anypoint Studio:

Prerequisites

This document assumes that your are familiar with Anypoint Studio and polling in general. Read more about poll scopes in Mule.

Fixed Frequency Scheduler

As the name implies, this method of configuring a poll schedule simply defines a fixed, time-based frequency for polling a source.

Studio Visual Editor

In Studio’s visual editor, open the Poll message processor’s properties editor. Select Fixed frequency scheduler, then adjust the values of the fields according to the table below.

poll schedulers 88dcf
Field Default Value Description XML

Frequency

1000

Polling frequency, relative to time unit. When set to 0 or a negative value, it switches to the default.

frequency="1000"

Start Delay

0

Upon triggering the flow for the first time, Mule stalls the running of the poll for a specific amount of time. This time period is expressed in the same time units as the frequency.

startDelay="0"

Time unit

MILLISECONDS

The time unit for the frequency value.

MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS

timeUnit="MILLISECONDS"

XML Editor

In Studio’s XML editor, add a fixed-frequency-scheduler child element to your poll element. Configure the child element’s attributes according to the table below.

<poll doc:name="Poll">
  <fixed-frequency-scheduler frequency="1000" timeUnit="MILLISECONDS" startDelay="0"/>
  <sfdc:authorize config-ref="SalesforceGlobal" display="Salesforce1" doc:name="Salesforce1"/>
</poll>
Attribute Description Example

frequency

Polling frequency, relative to time unit. When set to 0 or a negative value, it switches to the default.

frequency="1000"

timeUnit

The time unit for the frequency value.

MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS

timeUnit="MILLISECONDS"

startDelay

Upon triggering the flow for the first time, Mule stalls the running of the poll for a specific amount of time. This time period is expressed in the same time units as the frequency.

startDelay="0"

Cron Scheduler

As the name implies, this method allows you to configure a polling schedule using cron expressions. If you’re not familiar with cron syntax, don’t be intimidated! It’s reasonably easy to learn, and you can even leverage online tools that can help you build cron expressions.

Studio Visual Editor

In Studio’s visual editor, open the Poll message processor’s properties editor. Select Cron scheduler, then adjust the value of the Expression field according to the table below.

poll schedulers cef8a
Field Default Value Description XML

Expression

-

Use cron expression to define poll schedule.

expression="1 1 1 1,7 * ?"

Cron Time Zone

Time zone passed as system property, or in machine’s operating system.

Timezone in java time zone format

The table below offers a few examples of typical Cron expressions:

Expression Behavior

0 0 12 * * ?

Poll at 12pm (noon) every day

0 15 10 ? * *

Poll at 10:15am every day

0 15 10 * * ?

Poll at 10:15am every day

0 15 10 * * ? *

Poll at 10:15am every day

0 15 10 * * ? 2005

Poll at 10:15am every day during the year 2005

0 * 14 * * ?

Poll every minute starting at 2pm and ending at 2:59pm, every day

0 0/5 14 * * ?

Poll every 5 minutes starting at 2pm and ending at 2:55pm, every day

1 1 1 1,7 * ?

Poll the first day of January and the first day of June, every year (in the first second of the first minute of the first hour)

XML Editor

In Studio’s XML editor, add a schedulers:cron-scheduler child element to your poll element. Configure the child element’s attribute according to the table below.

<poll doc:name="Poll" frequency="1000">
        <schedulers:cron-scheduler expression="1 1 1 1,7 * ?" timeZone="America/Argentina/Buenos_Aires"/>
        <sfdc:authorize config-ref="SalesforceGlobal" display="Salesforce1" doc:name="Salesforce1"/>
    </poll>
Parameter Default Value Description Example

expression

-

Use cron expression to define poll schedule.

expression="1 1 1 1,7 * ?"

timeZone

Time zone passed as system property, or in machine’s operating system.

Timezone in java time zone format

timeZone="America/Argentina/Buenos_Aires"

Here are a few examples of typical Cron expressions:

Expression Behavior

0 0 12 * * ?

Poll at 12pm (noon) every day

0 15 10 ? * *

Poll at 10:15am every day

0 * 14 * * *

Poll every minute starting at 2pm and ending at 2:59pm, every day

0 0/5 14 * * *

Poll every 5 minutes starting at 2pm and ending at 2:55pm, every day

0 0 0 1,7 * *

Poll the first day of January and the first day of June, every year (in the first second of the first minute of the first hour)

See Also