Reaction Processes
Reaction processes are used to react to specific conditions in Redwood Server. Several types of reaction processes are supported:
- Any - can be called from a process server as well as remote systems.
- Check - can be called from a process server when a process server check fails.
- Promote Further Pusher - is called when you promote a System_Import_Archive file to another remote system.
- Push Acceptor - can be called when a CAR file is imported from its Source or Both remote system.
- Pusher - can be called to push objects to remote systems.
Reaction process definitions can be of any definition type, allowing you to fix certain situations like a hanging MS SQL Server database or Windows Server. As soon as you select the reaction definition type, the process definition is populated with the required parameters, any unknown parameters might be removed in the process. When you create a reaction type process definition, ensure you start off by specifying the correct reaction type prior to creating parameters.
All reaction process types have the following set of parameters, additional reaction process-specific parameters are available:
Address
- the address to use, for promotion reaction processes this will be URL of the remote system.Data
- free form expression.Message
- optional message.Source Object
- name of the source system that fired the reaction job.Source Object Type
- type of the source system that fired the reaction job.Source Object UniqueId
- UniqueId of the source system that fired the reaction job.
Procedure
Creating a Process Server Check Reaction Process
- Navigate to Definitions > Processes.
- Choose New Process Definition from the context-menu.
- Fill in the Name and the Source fields.
- On the Process Control tab, fill the Default Queue field; this is needed as the definition is submitted automatically.
- On the Options tab, select Check in the Reaction Process Type field.
- Choose Save and Close.
- Navigate to Environment > Process Servers.
- Choose Edit from the context menu of you platform agent process server.
- On the Checks tab, create a process server check, see Oracle database check for an example.
- Select your previously created definition in the Process Definition field; when this check fails, the process definition will be submitted automatically.
- Choose Save & Close.
Creating Promotion Reaction Processes
See the examples in the dedicated topic.
Examples
Reaction Process Type Any
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 Definition Type Check
A simple CMD script that reboots MS Windows Servers
shutdown /r /f /c "Restarted by central process automation" /d u 254:254
Reaction Definition Type Push Acceptor
The following is a allow everything Push Acceptor RedwoodScript process definition.
{
//do nothing, accept everything
}
Reaction Process Type Pusher
The following code illustrates a simple Pusher reaction job:
{
JobDefinition jDefinition = jcsSession.getJobDefinitionByName("System_Promote");
Job process = jDefinition.prepare();
process.getJobParameterByName("exportRuleSetBusinessKey").setInValueString(exportRuleSetBusinessKey);
process.getJobParameterByName("remoteSystemBusinessKey").setInValueString(remoteSystemBusinessKey);
process.getJobParameterByName("sendToRemoteSystem").setInValueString(sendToRemoteSystem);
jcsSession.persist();
}
Reaction Process Type Promote Further Pusher
The following code illustrates a simple Promote Further Pusher reaction job:
{
JobDefinition jDefinition = jcsSession.getJobDefinitionByName("System_Promote_Further");
Job process = jDefinition.prepare();
process.getJobParameterByName("SourceObject").setInValueString(SourceObject);
process.getJobParameterByName("SourceObjectType").setInValueString(SourceObjectType);
process.getJobParameterByName("SourceObjectUniqueId").setInValueNumber(SourceObjectUniqueId);
process.getJobParameterByName("Address").setInValueString(Address);
process.getJobParameterByName("CARFile").setInValueString(CARFile);
process.getJobParameterByName("OriginalJobId").setInValueString(OriginalJobId);
if(Message != null)
{
process.getJobParameterByName("Message").setInValueString(Message);
}
else
{
process.getJobParameterByName("Message").setInValueString("Some default message.");
}
if(Data != null)
{
process.getJobParameterByName("Data").setInValueString(Data);
}
else
{
process.getJobParameterByName("Data").setInValueString("SomeFile");
}
jcsSession.persist();
}
See Also
JobChain JobDefinition ProcessDefinition ReactionJobDefinition ReactionProcessDefinition