public class OpennmsKafkaProducer extends Object implements AlarmLifecycleListener, EventListener, AlarmFeedbackListener, OnmsTopologyConsumer, ThreadAwareEventListener
Modifier and Type | Field and Description |
---|---|
static String |
KAFKA_CLIENT_PID |
Constructor and Description |
---|
OpennmsKafkaProducer(ProtobufMapper protobufMapper,
NodeCache nodeCache,
org.osgi.service.cm.ConfigurationAdmin configAdmin,
EventSubscriptionService eventSubscriptionService,
OnmsTopologyDao topologyDao) |
public static final String KAFKA_CLIENT_PID
public OpennmsKafkaProducer(ProtobufMapper protobufMapper, NodeCache nodeCache, org.osgi.service.cm.ConfigurationAdmin configAdmin, EventSubscriptionService eventSubscriptionService, OnmsTopologyDao topologyDao)
public void init() throws IOException
IOException
public void destroy()
public boolean shouldForwardAlarm(OnmsAlarm alarm)
public void handleAlarmSnapshot(List<OnmsAlarm> alarms)
AlarmLifecycleListener
handleAlarmSnapshot
in interface AlarmLifecycleListener
alarms
- canonical set of alarms in the databasepublic void preHandleAlarmSnapshot()
AlarmLifecycleListener
AlarmLifecycleListener.handleAlarmSnapshot(java.util.List<org.opennms.netmgt.model.OnmsAlarm>)
.
This can be used to trigger any necessary state tracking to accurately handle
the snapshot results.preHandleAlarmSnapshot
in interface AlarmLifecycleListener
public void postHandleAlarmSnapshot()
AlarmLifecycleListener
AlarmLifecycleListener.handleAlarmSnapshot(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 to AlarmLifecycleListener.preHandleAlarmSnapshot()
if
an error occurred while preparing the snapshot i.e. when opening the transaction.postHandleAlarmSnapshot
in interface AlarmLifecycleListener
public void handleNewOrUpdatedAlarm(OnmsAlarm alarm)
AlarmLifecycleListener
handleNewOrUpdatedAlarm
in interface AlarmLifecycleListener
alarm
- a newly created or updated alarmpublic void handleDeletedAlarm(int alarmId, String reductionKey)
AlarmLifecycleListener
handleDeletedAlarm
in interface AlarmLifecycleListener
alarmId
- id of the alarm that was deletedreductionKey
- reduction key of the alarm that was deletedpublic String getName()
EventListener
getName
in interface EventListener
getName
in interface OnmsTopologyConsumer
String
object.public void onEvent(IEvent event)
EventListener
onEvent
in interface EventListener
event
- a IEvent
object.public Set<OnmsTopologyProtocol> getProtocols()
getProtocols
in interface OnmsTopologyConsumer
public void consume(OnmsTopologyMessage message)
consume
in interface OnmsTopologyConsumer
public void setTopologyVertexTopic(String topologyVertexTopic)
public void setTopologyEdgeTopic(String topologyEdgeTopic)
public void setEventTopic(String eventTopic)
public void setAlarmTopic(String alarmTopic)
public void setNodeTopic(String nodeTopic)
public void setAlarmFeedbackTopic(String alarmFeedbackTopic)
public void setEventFilter(String eventFilter)
public void setAlarmFilter(String alarmFilter)
public OpennmsKafkaProducer setDataSync(KafkaAlarmDataSync dataSync)
public void handleAlarmFeedback(List<AlarmFeedback> alarmFeedback)
AlarmFeedbackListener
handleAlarmFeedback
in interface AlarmFeedbackListener
alarmFeedback
- the collection of alarm feedbackpublic boolean isForwardingAlarms()
public CountDownLatch getEventForwardedLatch()
public CountDownLatch getAlarmForwardedLatch()
public CountDownLatch getNodeForwardedLatch()
public CountDownLatch getAlarmFeedbackForwardedLatch()
public void setSuppressIncrementalAlarms(boolean suppressIncrementalAlarms)
public AlarmCallbackStateTracker getAlarmCallbackStateTracker()
public void setKafkaSendQueueCapacity(int kafkaSendQueueCapacity)
public int getNumThreads()
getNumThreads
in interface ThreadAwareEventListener
public CountDownLatch getForwardedTopologyVertexMessage()
public CountDownLatch getForwardedTopologyEdgeMessage()
public String getEncoding()
public void setEncoding(String encoding)
public int getNumEventListenerThreads()
public void setNumEventListenerThreads(int numEventListenerThreads)
Copyright © 2021. All rights reserved.