
@Deprecated public class AlertService extends Object implements HasLifecycle, AgentService
AlertEvent with the information needed to act upon
the change.
This Alert management component is activated for all agents.
The AlertService also keeps a summary and a history for all the raised
alerts that have not been cleared.
For Agents of type WORKER or for services (MCM, OCS_BRIDGE, etc) the internal
raised alert summary is published on the status bus wrapped in
a StatusRaisedAlertSummary object when:
- the Agent starts up
- when a Console or a Service connects to the buses
For all Agents this raised alert summary can be published on request via the #publishRaisedAlertSummary
method; this method is meant to be invoked by Agents that do not hold an
up-to-date copy of an alert summary object.
Raised Alert listening on the buses: the AlertService also provides
the ability to start a status bus message listener to intercept Alert related
status messages from other subsystems and notify the registered AlertListeners
accordingly.
To activate the status bus message listener the method #startStatusAlertListening
must be invoked before theHasLifecycle#start phase, providing a
Predicate<AgentInfo> to select which agents to listen to.
By default status bus listening is activated for Consoles and Services with
a Predicate selecting either WORKERS or Services.| Constructor and Description |
|---|
AlertService()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClearAlertHandler(ClearAlertHandler handler)
Deprecated.
Add a ClearAlertHandler to this Subsystem.
|
void |
addListener(AlertListener listener)
Deprecated.
|
void |
build()
Deprecated.
First lifecycle hook.
|
String[] |
clearAlerts(String... alertId)
Deprecated.
Method similar to
#clearAlerts(String, String...) with default
source equal to the agent name. |
String[] |
clearAlertsForSource(String source,
String... alertId)
Deprecated.
Clear one or more Alerts for a given source by providing the alert id
of the alerts to be cleared.
|
String[] |
clearAllAlerts()
Deprecated.
Method similar to
#clearAllAlerts(String) with default
source equal to the agent name. |
String[] |
clearAllAlertsForSource(String source)
Deprecated.
Attempt to clear all the outstanding alerts for a given source.
|
String |
getAgentServiceName()
Deprecated.
Get the name of this service.
|
Map<String,RaisedAlertSummary> |
getAllSummaries()
Deprecated.
|
RaisedAlertSummary |
getRaisedAlertSummary()
Deprecated.
Clients interested in getting the full alert summary should
use the publishRaisedAlertSummary method.
|
RaisedAlertSummary |
getSummary(String source)
Deprecated.
|
void |
postInit()
Deprecated.
Population of clear alert handlers.
|
void |
postShutdown()
Deprecated.
Called from the enclosing
Subsystem when
HasLifecycle.shutdown() has been called after shtudownNow has
been invoked on all the children. |
void |
publishRaisedAlertSummary()
Deprecated.
Publish on the status bus the Subsystem's RaisedAlertSummary.
|
void |
raiseAlert(Alert alert,
AlertState severity,
String cause)
Deprecated.
Method similar to
#raiseAlert(String,Alert,AlertState,String)
where the source argument is set to be the agent name. |
void |
raiseAlert(String source,
Alert alert,
AlertState severity,
String cause)
Deprecated.
Raise an Alert with a given AlertState for a given source.
|
void |
removeListener(AlertListener listener)
Deprecated.
|
void |
shutdown()
Deprecated.
Called from the enclosing
Subsystem when
HasLifecycle.shutdown() has been called. |
void |
start()
Deprecated.
Called from the enclosing
Subsystem when
Agent.startAgent() has been called. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinit, postBuild, postStartstartForAgentpublic String getAgentServiceName()
AgentServicegetAgentServiceName in interface AgentServicepublic void build()
HasLifecyclebuild in interface HasLifecyclepublic void postInit()
postInit in interface HasLifecyclepublic void start()
HasLifecycleSubsystem when
Agent.startAgent() has been called. At the time
it is called :
PhaseState is
INITIALIZING
connection with the messaging layer is effective, the enclosing
subsystem has started StatusHeartBeat
publication
the startup configuration has been loaded (if provided). IMPORTANT
NOTE : This statement will not be true in future releases. Code that
expect the startup configuration to be loaded should be moved from
start to postStart.
super.start()start in interface HasLifecyclepublic void shutdown()
HasLifecycleSubsystem when
HasLifecycle.shutdown() has been called. At the time it
is called :
PhaseState is CLOSING.
HardwareController.checkStopped() has
been called
shutdown in interface HasLifecyclepublic void postShutdown()
HasLifecycleSubsystem when
HasLifecycle.shutdown() has been called after shtudownNow has
been invoked on all the children. At the time it
is called :
PhaseState is CLOSING.
HardwareController.checkStopped() has
been called
postShutdown in interface HasLifecyclepublic void addClearAlertHandler(ClearAlertHandler handler)
handler - The ClearAlertHandler class that will handle the clearing
of alerts.public void raiseAlert(String source, Alert alert, AlertState severity, String cause)
AlertListeners
will be notified with an AlertEvent of type ALERT_RAISED.
A special case is when the source is equal to the agent name. In this
case we have a listener that will publish a status message on the buses.alert - The Alert instance to be raisedseverity - The AlertState of this Alert.cause - The reason the Alert was raised.source - The source for which we raise an alertpublic void raiseAlert(Alert alert, AlertState severity, String cause)
#raiseAlert(String,Alert,AlertState,String)
where the source argument is set to be the agent name. This is a convenience
method that will trigger a status message publication.alert - severity - cause - public String[] clearAlertsForSource(String source, String... alertId)
source - The source for which to clear the alerts.alertId - the Id of the Alerts to be cleared.@Command(description="Clear alerts", type=ACTION) public String[] clearAlerts(String... alertId)
#clearAlerts(String, String...) with default
source equal to the agent name.
This method is annotated to be invoked over the buses by other consoles.alertId - public String[] clearAllAlertsForSource(String source)
source - the source for which to clear the alerts.@Command(description="Clear all alerts", type=ACTION) public String[] clearAllAlerts()
#clearAllAlerts(String) with default
source equal to the agent name.
This method is annotated to be invoked over the buses by other consoles.@Deprecated @Command(description="Get the Raised Alert Summary", type=QUERY) public RaisedAlertSummary getRaisedAlertSummary()
@Command(description="Publish the Raised Alert Summary", type=QUERY) public void publishRaisedAlertSummary()
public final void addListener(AlertListener listener)
public final void removeListener(AlertListener listener)
public RaisedAlertSummary getSummary(String source)
public Map<String,RaisedAlertSummary> getAllSummaries()
Copyright © 2018 LSST. All rights reserved.