Class JmsNorthbounder
- java.lang.Object
-
- org.opennms.netmgt.alarmd.api.support.AbstractNorthbounder
-
- org.opennms.netmgt.alarmd.northbounder.jms.JmsNorthbounder
-
- All Implemented Interfaces:
java.lang.Runnable
,Northbounder
,StatusFactory<NorthboundAlarm>
,org.springframework.beans.factory.InitializingBean
public class JmsNorthbounder extends AbstractNorthbounder implements org.springframework.beans.factory.InitializingBean
Northbound Interface JMS ImplementationAllows alarms to be automatically forwarded to a JMS destination. JMS implementation neutral, defaults to ActiveMQ. To change, add a Spring bean that implements javax.jms.ConnectionFactory and change OpenNMS property opennms.alarms.northbound.jms.connectionFactoryImplRef to that bean's ID. It will be wrapped in the Spring's CachingConnectionFactory so your bean does not need to handle caching or pooling itself.
Configuration is done in $ONMS_HOME/etc/jms-northbounder-configuration.xml and is similar to the syslog NBI config file. See JmsNorthbounderConfig or the appropriate schema file for details.
- Author:
- David Hustace, David Schlenk
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NBI_NAME
The Constant NBI_NAME.
-
Constructor Summary
Constructors Modifier Constructor Description protected
JmsNorthbounder()
Instantiates a new JMS northbounder.JmsNorthbounder(JmsNorthbounderConfig config, javax.jms.ConnectionFactory jmsNorthbounderConnectionFactory, JmsDestination destination)
Instantiates a new JMS northbounder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accepts(NorthboundAlarm alarm)
Accepts.void
afterPropertiesSet()
void
forwardAlarms(java.util.List<NorthboundAlarm> alarms)
Forward alarms.JmsNorthbounderConfig
getConfig()
Gets the configuration.JmsDestination
getDestination()
Gets the destination.javax.jms.ConnectionFactory
getJmsNorthbounderConnectionFactory()
Gets the JMS northbounder connection factory.boolean
isReady()
Used to determine if the northbounder is ready to accept alarms.void
setJmsNorthbounderConnectionFactory(javax.jms.ConnectionFactory jmsNorthbounderConnectionFactory)
Sets the JMS northbounder connection factory.-
Methods inherited from class org.opennms.netmgt.alarmd.api.support.AbstractNorthbounder
createMapping, createSyncLostMessage, discard, getName, onAlarm, onPostStart, onPreStart, onStop, preserve, reloadConfig, run, setMaxBatchSize, setMaxPreservedAlarms, setNaglesDelay, setRetryInterval, start, stop
-
-
-
-
Field Detail
-
NBI_NAME
public static final java.lang.String NBI_NAME
The Constant NBI_NAME.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JmsNorthbounder
public JmsNorthbounder(JmsNorthbounderConfig config, javax.jms.ConnectionFactory jmsNorthbounderConnectionFactory, JmsDestination destination)
Instantiates a new JMS northbounder.- Parameters:
config
- the configurationjmsNorthbounderConnectionFactory
- the JMS northbounder connection factorydestination
- the destination
-
JmsNorthbounder
protected JmsNorthbounder()
Instantiates a new JMS northbounder.
-
-
Method Detail
-
accepts
public boolean accepts(NorthboundAlarm alarm)
Description copied from class:AbstractNorthbounder
Accepts.- Specified by:
accepts
in classAbstractNorthbounder
- Parameters:
alarm
- the alarm- Returns:
- true, if successful
-
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.
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception
-
forwardAlarms
public void forwardAlarms(java.util.List<NorthboundAlarm> alarms) throws NorthbounderException
Description copied from class:AbstractNorthbounder
Forward alarms.- Specified by:
forwardAlarms
in classAbstractNorthbounder
- Parameters:
alarms
- the alarms- Throws:
NorthbounderException
- the northbounder exception
-
getDestination
public JmsDestination getDestination()
Gets the destination.- Returns:
- the destination
-
getConfig
public JmsNorthbounderConfig getConfig()
Gets the configuration.- Returns:
- the configuration
-
getJmsNorthbounderConnectionFactory
public javax.jms.ConnectionFactory getJmsNorthbounderConnectionFactory()
Gets the JMS northbounder connection factory.- Returns:
- the JMS northbounder connection factory
-
setJmsNorthbounderConnectionFactory
public void setJmsNorthbounderConnectionFactory(javax.jms.ConnectionFactory jmsNorthbounderConnectionFactory)
Sets the JMS northbounder connection factory.- Parameters:
jmsNorthbounderConnectionFactory
- the new JMS northbounder connection factory
-
-