Package org.opennms.netmgt.alarmd.api
Interface AlarmLifecycleListener
-
- All Known Implementing Classes:
Bsmd
,DroolsAlarmContext
,ElasticAlarmIndexer
,OpennmsKafkaProducer
public interface AlarmLifecycleListener
A simplified version of theAlarmEntityListener
interface with support for periodic snapshots.- Author:
- jwhite
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
handleAlarmSnapshot(java.util.List<OnmsAlarm> alarms)
Called periodically with a complete set of alarms as present in the database at the given timestamp.void
handleDeletedAlarm(int alarmId, java.lang.String reductionKey)
Called when an alarm has been deleted.void
handleNewOrUpdatedAlarm(OnmsAlarm alarm)
Called when an alarm has been created or updated.void
postHandleAlarmSnapshot()
Called afterhandleAlarmSnapshot(java.util.List<org.opennms.netmgt.model.OnmsAlarm>)
has been called on all the listeners, and after the session & transaction used to perform the snapshot has been closed.void
preHandleAlarmSnapshot()
Called before the transaction is opened and the alarms are read for subsequent calls tohandleAlarmSnapshot(java.util.List<org.opennms.netmgt.model.OnmsAlarm>)
.
-
-
-
Method Detail
-
handleAlarmSnapshot
void handleAlarmSnapshot(java.util.List<OnmsAlarm> alarms)
Called periodically with a complete set of alarms as present in the database at the given timestamp. This should be used to synchronize any state to ensure it matches what is currently in the database. Note that it is possible that the *current* state of alarms is different from the state at the time at which the snapshot was taken. Implementations should take this in consideration when performing any state synchronization. This method will be called while the related session & transaction that created the alarm are still open. All of the listeners are invoked serially, so the implementors should avoid blocking when possible.- Parameters:
alarms
- canonical set of alarms in the database
-
preHandleAlarmSnapshot
void preHandleAlarmSnapshot()
Called before the transaction is opened and the alarms are read for subsequent calls tohandleAlarmSnapshot(java.util.List<org.opennms.netmgt.model.OnmsAlarm>)
. This can be used to trigger any necessary state tracking to accurately handle the snapshot results.
-
postHandleAlarmSnapshot
void postHandleAlarmSnapshot()
Called afterhandleAlarmSnapshot(java.util.List<org.opennms.netmgt.model.OnmsAlarm>)
has been called on all the listeners, and after the session & transaction used to perform the snapshot has been closed. This can be used to trigger any necessary post-processing of the results once the related session has been closed. This function may be called immediately after a call topreHandleAlarmSnapshot()
if an error occurred while preparing the snapshot i.e. when opening the transaction.
-
handleNewOrUpdatedAlarm
void handleNewOrUpdatedAlarm(OnmsAlarm alarm)
Called when an alarm has been created or updated. This method will be called while the related session & transaction that created the alarm are still open. All of the listeners are invoked serially, so the implementors should avoid blocking when possible.- Parameters:
alarm
- a newly created or updated alarm
-
handleDeletedAlarm
void handleDeletedAlarm(int alarmId, java.lang.String reductionKey)
Called when an alarm has been deleted. This method will be called while the related session & transaction that created the alarm are still open. All of the listeners are invoked serially, so the implementors should avoid blocking when possible.- Parameters:
alarmId
- id of the alarm that was deletedreductionKey
- reduction key of the alarm that was deleted
-
-