Based on an Expression
AMPS provides an If
module for stopping execution of the action unless a specific condition is met.
amps-action-if-condition
Checks whether the specified expression is true or false.
If the expression evaluates to true, subsequent steps in the action run. If not, the action stops at this step.
Condition
(required)
Specifies the condition to evaluate. The condition must be a valid AMPS filter.
The condition will substitute variables from the current context before being evaluated.
There is no default for this parameter.
This module does not add any variables to the AMPS context.
For example, the following action publishes a message to a topic if a client with a name that matches a specific expression logs on.
The example above is provided to illustrate use of amps-action-if-condition
.
In practice, this could also be done using an amps-action-on-publish-message
action to monitor the /AMPS/ClientStatus
topic with a filter.
Last updated