Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

Scheduler XML Reference

A XML for the Scheduler has these elements:

  • scheduler parent element that encloses the rest of the elements.

  • scheduling-strategy block inside scheduler.

  • fixed-frequency or cron element inside the scheduling-strategy block.

Properties of Fixed Frequency (<fixed-frequency>)

Attribute Description Example

frequency

Triggering 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 and startDelay values:

MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS

timeUnit="MILLISECONDS"

startDelay

Upon triggering the flow for the first time, Mule delays the first execution of the scheduler for a specific amount of time. This time period is expressed in the same time units as the frequency.

startDelay="0"


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">

    <flow name="componentsFlow">
        <scheduler>
            <scheduling-strategy>
                <fixed-frequency startDelay="5" frequency="10" timeUnit="SECONDS"/>
            </scheduling-strategy>
        </scheduler>
        <logger message="my message"/>
    </flow>

</mule>

Properties of Cron (<cron>)

For more complex scheduling strategies, you can use a cron expression.

Parameter Default Value Description Example

expression

-

Use a cron expression for when to do a trigger.

---- 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" ----

Example that uses a cron expression:


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">

    <flow name="componentsFlow">
        <scheduler>
            <scheduling-strategy>
                <cron expression="0 0 12 * * ?"/>
            </scheduling-strategy>
        </scheduler>
        <logger message="my message"/>
    </flow>

</mule>

See Also