This example has three Job Chains.
Each job chain having its own set of jobs as shown below.
Job_Chain1
- Job11
- Job12
- Job13
- finish
Job_Chain2
- Job21
- Job22
- Job23
- finish
Job_Chain3
- Job31
- Job32
- Job33
When Job_Chain1 has finished on host1 Job_Chain2 on host2 should start. When Job_Chain2 on host2 has finished Job_Chain3 on host1 should start.
How it works:
- The finish job in Job_Chain1 creates an event for the event processor on host1.
- The event handler creates an order for Job_Chain2 on host 2 when the event "jobchain1" arrives. Than the event will "jobchain1" be deleted
- The finish job in Job_Chain2 creates an event for the event processor on host1.
- The event handler creates an order for Job_Chain3 on host 1 when the event "jobchain2" arrives. Than the event "jobchain2" will be deleted
The event handler
<?xml version="1.0" encoding="UTF-8"?> <actions> <action name="jobchain1"> <events> <event_group group="group"> <event event_id="jobchain1" event_class="example" /> </event_group> </events> <commands> <remove_event> <event event_id="jobchain1" event_class="example" /> </remove_event> <command name="start_jobchain2" scheduler_host="vmubuntu1" scheduler_port="4444"> <order job_chain="events_remote/job_chain2" replace="yes" /> </command> </commands> </action> <action name="jobchain2"> <events> <event_group group="group"> <event event_id="jobchain2" event_class="example" /> </event_group> </events> <commands> <command name="command_1"> <order job_chain="events_remote/job_chain3" replace="yes" /> </command> <remove_event> <event event_id="jobchain2" event_class="example" /> </remove_event> <command name="command_2" /> </commands> </action> </actions>
You can download the source for this example from here.
In the zip, you find two live folders, one for host1 and one for host2.
There is also a event handler for host1. Please copy this the config/events and configure the actual host names or ip addresses.