Creating Operator Messages
You create operator messages with the System_OperatorMessage process definition or with RedwoodScript. Operator messages are used to provide more information about errors that occur and/or ask the operator which steps to take when in a given situation. Operator messages are static, that is, they will not affect the process or chain directly - if you want to restart a specific step or jump to a step in a chain based on the reply of an operator, consider using user messages instead.
tip
You can reply to process-related operator messages from the context-menu of the related process.
note
Empty replies are not accepted.
Reply expressions can be defined as plain text or regular expressions which force the reply to match a regular expression, the default is ^Acknowledge$.
Using the System_OperatorMessage process definition or Redwood Script, you can create multiple choice operator messages as follows:
- Message /
message
- the message that is displayed to the operator - Reply Expression /
replyExpression
- A plain text or regular expression in the form of^Option 1|Option 2|...|Option <n>$
In the above list, parameters are referred-to as <Parameter Description>
/ <parameter_name>
; the parameter description is usually displayed in the submit wizard ( when set ), both are displayed in the Process Definition show page under the Parameters section.
note
To get a combo box in the reply window this syntax ^a|b|c|d$
must be used, it is a regular expression.
The ^
means starting with
, the |
means or
and the $
means ending with
; $
must be the last character.
Regular expressions are very powerful and can get complex. Avoid using special characters in the replyExpression unless their meaning in regular expression syntax is clear. Special characters include:
'.', '?', '*', '+', '\', '^', '$', '{', '}', '|', '[[', ']', '(', ')'
Special characters can be escaped, which removes their special meaning, with the backslash \
character. For example, you want to specify a path on Windows in a replyExpression, use double backlashes \\
as path-separators, like c:\\Windows\\temp
. Note that in this particular case you could also use forward slashes /
instead, like c:/Windows/temp
.
Procedure
Create a simple operator message:
- Choose "Definitions > Processes".
- Choose Submit from the context-menu of System_OperatorMessage.
- Fill the Message parameter.
- Optionally fill the Reply Expression parameter.
- Choose Submit.
Reply to Above Operator Message
- Choose "Monitoring > Operator Messages".
- Choose the Refresh button to update the monitor.
- Locate the operator message with the previously specified text.
- Choose Reply from the context-menu and select Acknowledge if you have not specified a reply or fill-in the valid reply if you had specified a reply expression.
Create an operator message with a regex expression:
- Choose "Definitions > Processes".
- Choose Submit from the context-menu of System_OperatorMessage.
- Fill the Message parameter.
- Fill the Reply Expression parameter with a regular expression such as
^Yes|No|Maybe$
.
Example
Example 1
Create a simple operator message:
- Choose "Definitions > Processes".
- Choose Submit from the context-menu of System_OperatorMessage.
- Fill
This operator message is a simple test
into the Message parameter. - Fill
^Well done!$
into the Reply Expression parameter. - Choose Submit.
Reply to Above Operator Message:
- Choose "Monitoring > Operator Messages".
- Choose the Refresh button to update the monitor.
- Locate the operator message with the text This operator message is a simple test.
- Choose Reply from the context-menu and select
Well done!
in the Reply field.
Example 2
Create an operator message with a regex reply expression:
- Choose "Definitions > Processes".
- Choose Submit from the context-menu of System_OperatorMessage.
- Fill
This operator message is a somewhat more complex test
into the Message parameter. - Fill
^That was easy.|That was hard.|I don't know how hard that was.$
.
Reply to Above Operator Message:
- Choose "Monitoring > Operator Messages".
- Choose the Refresh button to update the monitor.
- Locate the operator message with the text This operator message is a somewhat more complex test.
- Choose Reply from the context-menu and select a reply from the list.
Example 3
Create a simple operator message from within RedwoodScript
{
OperatorMessage oMessage = jcsSession.createOperatorMessage();
oMessage.setPartition(jcsSession.getPartitionByName("GLOBAL"));
oMessage.setFullText("This operator message is a simple test");
oMessage.setReplyExpression("^Well done!$");
jcsSession.persist();
}
Create an operator message with a drop-down menu from within RedwoodScript
{
OperatorMessage oMessage = jcsSession.createOperatorMessage();
oMessage.setPartition(jcsSession.getPartitionByName("GLOBAL"));
oMessage.setFullText("This operator message is a somewhat more complex test");
oMessage.setReplyExpression("^That was easy.|That was hard.|I don't know how hard that was.$");
jcsSession.persist();
}
Example 4
Reply to multiple operator messages from within RedwoodScript, note that this script only handles default Active Monitoring Module Operator Messages. Retrieve the operator messages using executeObjectQuery.
{
String query = "select OperatorMessage.* from OperatorMessage";
for (OperatorMessage oMessage : jcsSession.executeObjectQuery(OperatorMessage.TYPE, query))
{
//Check the operator message requires a reply
if (oMessage.getReplyStatus() == ReplyStatus.Required)
{
oMessage.setReply("Acknowledge");
jcsSession.persist();
}
}
}
Example 5
Reply to an operator message from within RedwoodScript
{
//Query and bind parameter values
String query = "select OperatorMessage.* from OperatorMessage where OperatorMessage.FirstText = ?";
String param = "This operator message is a somewhat more complex test";
//Retrieve operator message(s) based on full text
for (OperatorMessage oMessage : jcsSession.executeObjectQuery(OperatorMessage.TYPE, query, new Object[] { param }))
{
//Check the operator message requires a reply
if (oMessage.getReplyStatus() == ReplyStatus.Required)
{
oMessage.setReply("That was hard.");
jcsSession.persist();
}
}
}
Example 6
Reply to multiple operator messages, note that this script does not handle all possible reply expressions, for example \d
.
It does handle the following:
^<option1>|<option2>[|<option...]$
- for example chain restart requests, or your own multiple choice operator messages^<string>$
- such as^Acknowledge$
, the default Active Monitoring Module operator messages<string>
- any string (\
and|
are prohibited)
Depending on your environment, using switch instead of if/else if
may be faster
{
String query = "select OperatorMessage.* from OperatorMessage";
for (OperatorMessage oMessage : jcsSession.executeObjectQuery(OperatorMessage.TYPE, query))
{
//Check the operator message requires a reply
if (oMessage.getReplyStatus() == ReplyStatus.Required)
{
if (oMessage.getReplyExpression().indexOf("^") == 0
&& oMessage.getReplyExpression().indexOf("$") == oMessage.getReplyExpression().length() -1
&& oMessage.getReplyExpression().indexOf("|") > 0)
{
//Here you use the first valid answer as a reply, chain operator messages (Request Restart) will be rescheduled to Error
String[] ar = oMessage.getReplyExpression().split("\\|");
//Here you remove \ as these are used in some built-in reply expressions
oMessage.setReply(ar[0].replace("^", "").replace("\\", ""));
}
else if (oMessage.getReplyExpression().indexOf("^") == 0
&& oMessage.getReplyExpression().indexOf("$") == oMessage.getReplyExpression().length() -1
&& oMessage.getReplyExpression().indexOf("|") == -1)
{
//Here you use the only valid answer as a reply
oMessage.setReply(oMessage.getReplyExpression().replace("^", "").replace("$", ""));
}
else if (oMessage.getReplyExpression().indexOf("\\") == -1 && oMessage.getReplyExpression().indexOf("|") == -1)
{
//Here you use the reply expression as string, we filter out \ and | to avoid special regex expressions like \d; they should be skipped
oMessage.setReply(oMessage.getReplyExpression());
}
jcsSession.persist();
}
}
}
Note that the setReply()
method can only be called on persisted operator messages.
See Also
- Interacting with Operator Messages
- Creating Advanced Operator Message Reply Expressions
- Receiving Operator Messages on your Desktop
- Operator Messages Monitor
OperatorMessage