On Message Condition Timeout
AMPS provides a module to run an action when a message in a SOW topic meets a specific condition for longer than a specified period of time. For example, an action might be configured to publish a message to an Alerts
topic if an order is unprocessed for more than a specified timeout.
AMPS also provides a module, amps-action-on-alert
, that runs when either a message has been in a specific condition for a longer than expected period of time, or the module receives an out-of-focus notification indicating that the message no longer meets the tracking condition. Use that module if both conditions are important. Use this module if it is only important to track timeouts.
The amps-action-on-message-condition-timeout
monitors a SOW topic for messages that match a filter and triggers an action for each message that remains matched on that filter for at least the specified duration.
This module uses the Out-of-Focus notification (OOF) mechanism. When a message matches the specified topic and filter, the module begins tracking that message. If no OOF notification is received for that message within the specified timeout, the action runs for that message.
The module tracks each message that matches the filter individually, and will run once for each message that exceeds the timeout.
While the AMPS server is running, this action will trigger exactly once for each message after it reaches the timeout period. When AMPS restarts, if a message that had previously triggered this action still exists in the SOW topic (and still matches the filter provided, if any), the action will run for that message immediately after the module initializes on restart.
This action requires the following parameters. In addition to that, this module also accepts the optional parameters listed below:
Parameter | Description |
---|---|
| The name of the topic to monitor for messages. This parameter does not support regular expressions. The topic name must be either a SOW topic, a view or a conflated topic. Queues are not supported. There is no default for this parameter. |
| The message type of the topic to monitor for messages. There is no default for this parameter. |
| The amount of time to wait for an OOF notification for the message before running the action. |
| Sets the filter to apply. Only messages that match this filter will be monitored by this action. If no filter is provided, every message of the specified message type in topics that match the |
The module adds the following variables to the AMPS context:
Variable | Description |
---|---|
| The topic of the message that triggered the alert. |
| The current data of the message. |
| The length of the current data of the message, in bytes. |
| The bookmark of the message. Empty if there is no bookmark for the message. |
| The timestamp at which the module began tracking the message. |
| The client name of the current value of the message. |
| The current SowKey for the message. |
Last updated