Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Events
Question: How can I wait for an event in a job chain?
Introduction
In some cases it is necessary to wait for an event before proceeding with execution.
...
- setting up a job to create the event. This is a stand alone job.
- setting up a job chain with a wait step in the middle. When the event arrives, the execution proceeds and the event will be deleted.
- setting up the jobs for deleting and checking the event.
Requirements
The JobScheduler must run using a database. The events are stored permanently in the table "SCHEDULER_EVENTS".
Instructions
- Unzip all files of test_event.zip into the ./config folder of your active instance of the eventservice JobScheduler installation. After unzipping you will have all the objects needed to run the example in the live/test_events subfolder.
- Open the JS operations gui for the workload JobScheduler in your browser using http://scheduler_host:scheduler_port
- Find the
test_event/job chain_example_wait_for_event
job chain and click on it. - Click in the job chain menu on "add order"
- You see the order will run until the step 3 is reached. As the EVENT event does not exist, the order will wait for 10s and then check again.
- Switch to the tab Jobs.
- Find the
test_event/job_event_add
job chain and click on it. - In the Job menu press Start task immediately. This will create the EVENT event.
- Switch to the tab Job Chains.
- See the order proceeding with execution of the next step
How it works
The test_event/job_event_add
job is a dummy shell script job with a post processing part. In the post processing the com.sos.jitl.eventing.EventMonitorTaskAfter
JITL class is used to add an TEST.TEST_EVENT event.
...
You also can specify how to handle the existing or not existing of events with the paramters handle_existing_ah1. as="error|success" or handle_not_existing_as="error|success"
example
Code Block |
---|
handle_existing_as=error will wait until the events do not exist |
...
After adding the event, the order will proceed with to the next step and the event will be removed.
Related Downloads
...
- scheduler events - Documentation
...