Interface AlertManager
- All Superinterfaces:
AdminAware
- All Known Subinterfaces:
InternalAlertManager
- All Known Implementing Classes:
DefaultAlertManager
The alert manager provides two options for configuration of
alert configurations - as bulk or one by one. The AlertConfiguration is the main
interface of an alert configuration - a configuration based on String key-value property pairs.
To configure with a bulk of alert configurations, the configure(AlertConfiguration[])
method can be used. These configurations can be extracted from a resource using an AlertConfigurationParser. The parser AlertConfigurationParser.parse() returns an array
of AlertConfiguration. The XmlAlertConfigurationParser can be used to parse the
alerts.xml configuration file located under config/alerts.
To
Register/Unregister for alert events (of all types), use the AlertTriggeredEventManager
to add/remove AlertTriggeredEventListeners.
The triggerAlert(Alert) method
call allows alert triggers to 'fire' an alert and trigger an event to be sent to all
registered alert event listeners.
- Since:
- 8.0
- Author:
- Moran Avigdor
-
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(AlertConfiguration... configurations) Define an alert configuration for a 'bulk' of configurations.voiddisableAlert(Class<? extends AlertConfiguration> clazz) Disables a previously enabled alert.voidenableAlert(Class<? extends AlertConfiguration> clazz) Enable a previously set alert configuration.getAlertStatusByGroupId(String groupUid) <T extends AlertConfiguration>
TGet the currently set alert configuration.booleanisAlertEnabled(Class<? extends AlertConfiguration> clazz) booleanremoveConfig(Class<? extends AlertConfiguration> clazz) Removes a previously set alert configuration.voidsetConfig(AlertConfiguration config) Defines an alert configuration.voidtriggerAlert(Alert alert) Trigger an alert event for registered alert event listeners.Methods inherited from interface org.openspaces.admin.AdminAware
getAdmin
-
Method Details
-
configure
Define an alert configuration for a 'bulk' of configurations. Overrides all previously set properties for any of the alerts.See the
XmlAlertConfigurationParserwhich can be used to parse the default alerts.xml configuration file located under config/alerts.If
AlertConfiguration.isEnabled()returnstrueit is equivalent to calling (for a predefined alert)disableAlert(Class), followed bysetConfig(AlertConfiguration)followed byenableAlert(Class).If it returns
falseit is equivalent to calling (for a predefined alert)disableAlert(Class)followed bysetConfig(AlertConfiguration).if an alert configuration was not previously set, the current setting will be used.
- Parameters:
configurations- the alert configurations (as varargs).- Throws:
AlertConfigurationException- if the alert is already enabled (need to disable it first).- See Also:
-
setConfig
Defines an alert configuration. Overrides all previously set properties for this alert.The
AlertConfiguration.isEnabled()is ignored. To enable, callenableAlert(Class). To perform both operations in a single call, useconfigure(AlertConfiguration[]).An exception is raised if the alert is already enabled.
- Parameters:
config- the alert configuration- Throws:
AlertConfigurationException- if the alert is already enabled (need to disable it first).
-
enableAlert
Enable a previously set alert configuration. From this point, alerts will be triggered.If the alert is already enabled, the request is silently ignored.
- Parameters:
clazz- the class of the alert configuration- Throws:
AlertConfigurationException- if the alert can't be enabled for any of the following reasons:- if the configuration was not previously set.
- in the event of misconfiguration (such as failure to set an essential property).
- if initialization fails.
-
disableAlert
Disables a previously enabled alert. The configuration remains, but alerts will no longer be triggered. The alert can be enabled at a later time, based on previously set configuration.If the alert is already disabled, the request is silently ignored.
- Parameters:
clazz- the class of the alert configuration- Throws:
AlertConfigurationException- if the alert configuration was not previously set.
-
isAlertEnabled
- Parameters:
clazz- the class of the alert configuration- Returns:
trueif the alert is already enabled,falseif the alert is disabled or if it's configuration was not found.
-
removeConfig
Removes a previously set alert configuration.An exception is raised if the alert is currently enabled. Disable the alert prior to this call.
- Parameters:
clazz- the class of the alert configuration- Returns:
trueif removed ,falseif it did not exist in the first place.- Throws:
AlertConfigurationException- if the alert configuration can't be removed for any of the following reasons:- if the alert is currently enabled (need to disable it first).
- if the configuration was not previously set
-
getConfig
Get the currently set alert configuration.- Parameters:
clazz- the class of the alert configuration- Returns:
- The alert configuration implementation object set with the configuration properties.
- Throws:
AlertConfigurationException- if the alert configuration was not previously set.
-
triggerAlert
Trigger an alert event for registered alert event listeners.- Parameters:
alert- an alert.
-
getAlertTriggered
AlertTriggeredEventManager getAlertTriggered()- Returns:
- the alert event manager to register/unregister for alert events.
-
getAlertStatusByGroupId
- Parameters:
groupUid- The group unique identifier- Returns:
- the status of the alerts in this group
- Since:
- 12.0.0
-