[Home] [Index] [Previous] [Next]

Children Of Oddjob

Job Hierarchies

Oddjob jobs are arranged in a tree like hierarchy with an Oddjob job at the root. Only some jobs can have children, and only some jobs can have more than one child. Our root Oddjob job can only have one child.

Execution of jobs starts at the root and fans out down the tree like a Domino Cascade. The three main ways of controlling this cascade are using the jobs:

Executes it's child jobs in sequence - only executing the next if it's predecessor completes.
Executes it's child jobs all at once.
Protects it's children from the execution cascade. It's children must be executed in some other way.

While execution cascades down the tree job, state reflects up the tree. Generally a parent reflects the worst state of any of it's children - so a parent is in an Exception state if any of it's children are.

Child State

A Sequential Example

To demonstrate a sequential series of jobs lets change the Oddjob configuration we created in the previous section so that our ExecJob is surrounded by some useful information jobs.

Because our Oddjob root can only have one child we need to cut out our ExecJob

Cut out the ExecJob.

Next create a new sequential child of Oddjob, and create two echo jobs. Echo jobs just echo some text to the console.

Create two echo jobs.

Configure the echo jobs to display something before the ExecJob has run.

Configure Before

And after the ExecJob has run.

Configure After

Then click OK, to go back to Oddjob explorer and paste back our ExecJob onto the sequential job.

Paste back the ExecJob

Now the order is wrong, so use the mouse to drag the ExecJob to between the Before and After.

Drag the ExecJob

And finally save the configuration and run the sequence.

Cut out the ExecJob

And thats how easy it is to create a Sequence of Jobs.

Nesting Oddjob

Oddjob is just a job. It's job is to read a configuration, that is normally a file, and create the jobs required by the configuration and wire them together. It then runs the top most job in the hierarchy and reflects it's state.

By choosing a child type that is Oddjob we create a nested Oddjob. Nested Oddjobs allow large configurations to be broken down into more manageable units and they also allow repeated sections of configuration to be separated out so they need only be written once.

The examples are an example of nesting Oddjobs. Each example is a separate nested Oddjob. Take a look at examples.xml to see how it works.

Configuration values can be passed into a nested Oddjob using either the args, export and properties properties. The export property allows any type to be passed, such as a connection definition or even a reference to a job. The other two properties only pass text. The Reference Guide for Oddjob has more information on these properties.

A nested Oddjob can also have it's own job definitions. See the Developer Guide for more information on this.

[Home] [Index] [Previous] [Next]