Skip to main content

Ens.Alerting.AlertMonitor

class Ens.Alerting.AlertMonitor extends Ens.BusinessService

Business Service that checks whether any Ens.Alerting.ManagedAlert objects are open and have a next action time that has passed. For each such overdue ManagedAlert, a user callback sequence is initiated from the ProcessOverdueAlert()() method. The three stages of the callback sequence are as follows:

  1. The first stage of the callback sequence calls OnProcessOverdueAlert()(), which is a method that users can override in subclasses to execute any custom code they choose, as well as indicate whether all processing is complete for the current Managed Alert. The default implementation takes no action.
  2. The second stage of the callback sequence will check whether OverdueAlertRule is defined.
    • If no rule is defined, the default processing in stage 3 will control the behaviour.
    • Otherwise, the service will create a rule context object of type Ens.Alerting.Context.OverdueAlert using the GetOverdueAlertContext()() helper method. Users may override the helper method to instantiate user-defined subclasses of the base context. The newly created context object will then be supplied to the rule defined in OverdueAlertRule. The rule can update the NewNextActionTime or NewEscalationLevel properties to indicate the values of the ManagedAlert should be changed. The rule MUST return a boolean value to indicate whether a reminder should be sent. Note that if the EscalationLevel is increased, a notification will ALWAYS be sent to the Notification Manager. Furthermore, any changes made to the ManagedAlert object in the rule will be discarded by the AlertMonitor.
  3. If no actions are taken in stages 1 or 2, the default behaviour will always send a simple reminder request to the Notification Manager.

Property Inventory

Method Inventory

Parameters

parameter ADAPTER = Ens.InboundAdapter;
Inherited description: The type of adapter used to communicate with external systems
parameter SETTINGS = OverdueAlertRule::ruleSelector;
Inherited description: List of properties can be set as settings in the configuration file format is a comma separated list of property names

Properties

property Adapter as Ens.InboundAdapter;
Inherited description: The adapter instance
Property methods: AdapterGet(), AdapterGetSwizzled(), AdapterIsValid(), AdapterNewObject(), AdapterSet()
property OverdueAlertRule as %String;
Name of the Business Rule to invoke when determining what action to take for an overdue ManagedAlert. The rule should be configured to accept a context of type Ens.Alerting.Context.OverdueAlert, which includes properties allowing the user to update values for the ManagedAlert.
Property methods: OverdueAlertRuleDisplayToLogical(), OverdueAlertRuleGet(), OverdueAlertRuleIsValid(), OverdueAlertRuleLogicalToDisplay(), OverdueAlertRuleLogicalToOdbc(), OverdueAlertRuleNormalize(), OverdueAlertRuleSet()

Methods

method CheckForOverdueAlerts() as %Status
Actually create a resultset using the prepared statement in %SQLStatement and invoke the callback sequence to determine what actions should be taken for each overdue alert. All the logic for processing the alert is located in the ProcessOverdueAlert()() method.
method GetOverdueAlertContext(pManagedAlert As Ens.Alerting.ManagedAlert, Output pOverdueContext As Ens.Alerting.Context.OverdueAlert) as %Status
Helper method to instantiate an Ens.Alerting.Context.OverdueAlert context object for the rule specified in OverdueAlertRule. Users can subclass this method to return an extended context should they wish to.
classmethod OnGetConnections(Output pArray As %String, pItem As Ens.Config.Item)
Add connection to the Production's AlertNotificationManager
method OnInit() as %Status
Initialise %SQLStatement and ensure the rule specified in OverdueAlertRule exists.
method OnProcessInput(pInput As %RegisteredObject, Output pOutput As %RegisteredObject, ByRef pHint As %String) as %Status
Every time the adapter calls in to the service, check for any open Managed Alerts that have a next action time in the past.
method OnProcessOverdueAlert(pManagedAlert As Ens.Alerting.ManagedAlert, Output pProcessingComplete As %Boolean) as %Status
Callback invoked while processing the overdue alert in pManagedAlert. This method can be overridden in subclasses to take any actions a developer so chooses, and the standard processing of the alert can be bypassed by setting pProcessingComplete to 1.
method OnProcessOverdueRuleResult(pManagedAlert As Ens.Alerting.ManagedAlert, pOverdueContext As Ens.Alerting.Context.OverdueAlert, ByRef pSendNotification As %Boolean, ByRef pNotificationType As Ens.DataType.AlertNotificationType) as %Status
Helper method to process the result of the rule specified in OverdueAlertRule. Users can override this method, but should ensure that they handle changes to pManagedAlert in their code or by calling ##super() to invoke the base implementation of this method. pSendNotification is the return value from the rule, which indicates whether a notification should be sent. pNotificationType is the type of notification that should be sent.
method ProcessOverdueAlert(pManagedAlert As Ens.Alerting.ManagedAlert) as %Status
The main handler for overdue alerts. The overdue alert is passed in as pManagedAlert, and the method moves through the callback sequence described in the main class documentation for this class (Ens.Alerting.AlertMonitor).

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab