[Index]

scheduling:retry


This is a timer that runs it's job according to the schedule until the schedule expires or the job completes successfully.


Property Summary

clock The clock to use.
current This is the current/next result from the schedule.
haltOn The state of the Child Job from the nextDue property when the job begins to execute.
job The job to run when it's due.
lastDue The time the schedule was lastDue.
limits Used to limit the schedule.
name A name, can be any text.
reset  
schedule The Schedule used to provide execution times.
timeZone The time zone the schedule is to run in.

Example Summary

Example 1 File Polling.
Example 2 Using Retry with a Timer.

Property Detail

clock

Configured ByELEMENT
AccessREAD_WRITE
RequiredSet automatically.

The clock to use. Tells the current time.

current

AccessREAD_ONLY
RequiredSet automatically.

This is the current/next result from the schedule. This properties fromDate is used to set the nextDue date for the schedule and it's useNext (normally the same as toDate) property is used to calculate the following new current property after execution. This property is most useful for the Timer to pass limits to the Retry, but is also useful for diagnostics.

haltOn

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredRead only.

The state of the Child Job from the nextDue property when the job begins to execute.

job

Configured ByELEMENT
AccessWRITE_ONLY
RequiredYes.

The job to run when it's due.

lastDue

AccessREAD_ONLY
RequiredRead only.

The time the schedule was lastDue. This is set from the nextDue property when the job begins to execute.

limits

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

Used to limit the schedule. Usually this will be configured to be a parent timer's current interval.

name

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

A name, can be any text.

reset

Configured ByATTRIBUTE
AccessREAD_WRITE

schedule

Configured ByELEMENT
AccessREAD_WRITE
RequiredYes.

The Schedule used to provide execution times.

timeZone

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredSet automatically.

The time zone the schedule is to run in. This is the text id of the time zone, such as "Europe/London". More information can be found at TimeZone.


Examples

Example 1

File Polling. Check every 5 seconds for a file.

<oddjob id="this">
    <job>
        <scheduling:retry name="File Polling Example" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">
            <schedule>
                <schedules:interval interval="00:00:05"/>
            </schedule>
            <job>
                <sequential id="look" name="Look for files">
                    <jobs>
                        <exists file="${this.dir}/work/*.foo" id="check" name="Check File Exists"/>
                        <echo name="Echo to Console">Found ${check.exists[0]}</echo>
                    </jobs>
                </sequential>
            </job>
        </scheduling:retry>
    </job>
</oddjob>

Example 2

Using Retry with a Timer. A daily job retries twice.

<oddjob xmlns:schedules="http://rgordon.co.uk/oddjob/schedules" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling" xmlns:state="http://rgordon.co.uk/oddjob/state">
    <job>
        <scheduling:timer id="timer">
            <schedule>
                <schedules:daily from="08:00"/>
            </schedule>
            <job>
                <scheduling:retry id="retry">
                    <schedule>
                        <schedules:count count="2"/>
                    </schedule>
                    <job>
                        <state:flag id="flag-job" state="EXCEPTION"/>
                    </job>
                </scheduling:retry>
            </job>
        </scheduling:timer>
    </job>
</oddjob>


(c) Rob Gordon 2005 - 2017