Class DroolsNorthbounder
- java.lang.Object
-
- org.opennms.netmgt.alarmd.api.support.AbstractNorthbounder
-
- org.opennms.netmgt.alarmd.northbounder.drools.DroolsNorthbounder
-
- All Implemented Interfaces:
Runnable
,Northbounder
,StatusFactory<NorthboundAlarm>
,org.springframework.beans.factory.InitializingBean
public class DroolsNorthbounder extends AbstractNorthbounder implements org.springframework.beans.factory.InitializingBean
Process alarms via Drools.- Author:
- Alejandro Galue
-
-
Constructor Summary
Constructors Constructor Description DroolsNorthbounder(org.springframework.context.ApplicationContext context, DroolsNorthbounderConfigDao configDao, EventProxy eventProxy, String engineName)
Instantiates a new Drools northbounder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accepts(NorthboundAlarm alarm)
The abstraction makes a call here to determine if the alarm should be placed on the queue of alarms to be sent northerly.void
afterPropertiesSet()
void
forwardAlarms(List<NorthboundAlarm> alarms)
Each implementation of the AbstractNorthbounder has a nice queue (Nagle's algorithmic) and the worker thread that processes the queue calls this method to send alarms to the northern NMS.protected DroolsNorthbounderConfig
getConfig()
Gets the configuration.org.kie.api.runtime.KieSession
getKieSession()
Gets the kie session.Collection<? extends Object>
getKieSessionObjects()
Gets the kie session objects.boolean
isReady()
Used to determine if the northbounder is ready to accept alarms.protected void
onStop()
Override this to perform actions when stopping.void
sendEvent(Event event)
Send event.-
Methods inherited from class org.opennms.netmgt.alarmd.api.support.AbstractNorthbounder
createMapping, createSyncLostMessage, discard, getName, onAlarm, onPostStart, onPreStart, preserve, reloadConfig, run, setMaxBatchSize, setMaxPreservedAlarms, setNaglesDelay, setRetryInterval, start, stop
-
-
-
-
Field Detail
-
NBI_NAME
protected static final String NBI_NAME
The Constant NBI_NAME.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DroolsNorthbounder
public DroolsNorthbounder(org.springframework.context.ApplicationContext context, DroolsNorthbounderConfigDao configDao, EventProxy eventProxy, String engineName)
Instantiates a new Drools northbounder.- Parameters:
configDao
- the configuration DAOengineName
- the engine name
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
onStop
protected void onStop()
Description copied from class:AbstractNorthbounder
Override this to perform actions when stopping.- Overrides:
onStop
in classAbstractNorthbounder
-
accepts
public boolean accepts(NorthboundAlarm alarm)
The abstraction makes a call here to determine if the alarm should be placed on the queue of alarms to be sent northerly.- Specified by:
accepts
in classAbstractNorthbounder
- Parameters:
alarm
- the alarm- Returns:
- true, if successful
-
forwardAlarms
public void forwardAlarms(List<NorthboundAlarm> alarms) throws NorthbounderException
Each implementation of the AbstractNorthbounder has a nice queue (Nagle's algorithmic) and the worker thread that processes the queue calls this method to send alarms to the northern NMS.- Specified by:
forwardAlarms
in classAbstractNorthbounder
- Parameters:
alarms
- the alarms- Throws:
NorthbounderException
- the northbounder exception
-
getKieSessionObjects
public Collection<? extends Object> getKieSessionObjects()
Gets the kie session objects.- Returns:
- the kie session objects
-
getKieSession
public org.kie.api.runtime.KieSession getKieSession()
Gets the kie session.- Returns:
- the kie session
-
sendEvent
public void sendEvent(Event event)
Send event.- Parameters:
event
- the event
-
getConfig
protected DroolsNorthbounderConfig getConfig()
Gets the configuration.- Returns:
- the configuration
-
isReady
public boolean isReady()
Description copied from interface:Northbounder
Used to determine if the northbounder is ready to accept alarms. If no northbounders are ready, the caller can save resources by not creating and initializing theNorthboundAlarm
s. This method is called once after northbounder is registered and started. If the status were to change sometime after, the northbounder must re-register itself.- Specified by:
isReady
in interfaceNorthbounder
- Returns:
true
if the northbounder is ready to accept alarms,false
otherwise.
-
-