Reaction Job Definitions
A reaction Job Definition is a Job Definition that is executed in response to specific conditions. You might, for example, want to create a reaction Job Definition that generates an email or an Operator Message if a Platform Agent Job Server runs a check on an Oracle database and that check fails.
There are several types of reaction Job Definitions:
- Any: Can be called from a Job Server as well as remote systems.
- Check: Can be called automatically when a Platform Agent Job Server with a Check configured fails the check.
- Pusher, Push Acceptor, and Promote Further Pusher: Because these are specific to the Promotion Module, they are covered in Promotion Reaction Processes.
Any Job Definition can be a reaction Job Definition. To configure a Job Definition as a reaction Job Definition, display its Options tab and then choose an option from the Reaction Job Type dropdown list.
When you choose a Reaction Job Type, the Parameters tab is automatically populated with the available Parameters for that reaction Job type. Note that this may overwrite existing Parameters, so be sure to choose a Reaction Job Type at the beginning of the process. The screen shot below shows the Parameters tab after the Any reaction Job type is selected.
All reaction Job Definition types use the following set of Parameters. Specific Job Definition types may have additional Parameters.
Address
: The address to use. For promotion reaction Job Definitions, this is the URL of a different RunMyJobs instance (see Working with Remote Systems).Data
:A free form expression.Message
: An optional message.Source Object
: The name of the source system that triggered the reaction Job Definition.Source Object Type
: The object type of the source system that triggered the reaction Job Definition.Source Object UniqueId
: The unique ID of the source system that triggered the reaction Job Definition.
In addition, Job Definitions have a set of Parameters that are filled automatically by the caller, so there is no need to write REL expressions to supply them. Reaction Job Defnitions have the following automatically-populated Parameters:
SourceObject
: The name of the object that called the reaction Job Definition.SourceObjectUniqueId
: The unique ID of the object that called the reaction Job Definition.SourceObjectType
: The type of the object that called the reaction Job Definition.Address
: The destination/recipient address.Data
: A free-form expression.
Defining a Check Reaction Job Definition
When you create a Job Server Check on a Platform Agent Job Server, you can specify the reaction Job Definition to be called if that fails. To do so, choose the reaction Job Definition's name from the Job Definition dropdown list in the Job Server's Checks tab.
Example Reaction Job Definitions
Reaction Job Definition Type Any
This example is a CMD script that handles some types of MS SQL database service outages.
net start MSSQLSERVER 2>&1|FIND "2182"
IF %ERRORLEVEL% 1 goto :already_started
echo "service was stopped, has been restarted"
sc query MSSQLSERVER
exit /b 0
:already_started
echo "service was already started, attempting to restart it"
net stop MSSQLSERVER 2>&1 |FIND "HELPMSG"
IF %ERRORLEVEL% 1 goto :start_sql
:failure
rem get state of service and exit, manual intervention required
sc query MSSQLSERVER
exit /b 1
:start_sql
net start MSSQLSERVER 2>&1 |FIND "HELPMSG"
IF %ERRORLEVEL% 1 exit /b 0
goto :failure
Reaction Job Definition Type Check
This example is a simple CMD script that reboots MS Windows Servers.
shutdown /r /f /c "Restarted by central process automation" /d u 254:254