Oddjob Reminders

I always forget birthdays and I know there are loads of services to help me out here, but when you’ve written a scheduling system you want to use it.

I’ll start with Mum’s Birthday. Before I show you the underlying XML which is never pretty. I’ll show you a screen shot of the configuration.

Birthday Alert Configuration

Birthday Alert Configuration

The configuration simply consists of a timer with a yearly schedule that runs an email job. Here’s the XML:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<oddjob>
    <job>
        <scheduling:timer id="timer" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling">
            <schedule>
                <schedules:yearly onDate="05-26" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"/>
            </schedule>
            <job>
                <mail:send from="${my.alert.from}" host="${my.mailhost}" subject="Oddjob Alert!" to="${my.alert.to}" xmlns:mail="http://rgordon.co.uk/oddjob/mail"><![CDATA[It's Mum's Birthday!]]></mail:send>
            </job>
        </scheduling:timer>
    </job>
</oddjob>

And that’s it.

I have the mail properties set up in an oddjob.properties file in my home directory. Oddjob automatically looks for a file of this name on startup and loads the properties from it. This way I don’t have to supply private information in the configuration, and I can also share configuration without the need to edit it.

One thought on “Oddjob Reminders

  1. Pingback: Feature Comparison of Java Job Schedulers – Plus One | Rob's Blog