Package gov.usgs.earthquake.distribution
Class EIDSNotificationReceiver
- java.lang.Object
-
- gov.usgs.util.DefaultConfigurable
-
- gov.usgs.earthquake.distribution.DefaultNotificationReceiver
-
- gov.usgs.earthquake.distribution.EIDSNotificationReceiver
-
- All Implemented Interfaces:
NotificationIndexCleanup.Listener,NotificationReceiver,EIDSListener,Configurable
- Direct Known Subclasses:
EIDSProductReceiver
public class EIDSNotificationReceiver extends DefaultNotificationReceiver implements EIDSListener
Receive XML notifications using EIDS. This class implements the Configurable interface, and has the following options:- serverHost
- The EIDS Server hostname or IP address.
- serverPort
- The EIDS Server listen port, usually 39977.
- alternateServers
- A comma separated list of HOST:PORT pairs. The EIDSClient will attempt to connect to these servers when unable to connect to the primary serverHost:serverPort.
- trackingFile
- A file name used for tracking connection state. This is used to receive missed messages when (re)connecting.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEIDS_ALTERNATE_SERVERSProperty name for eids server alternate servers list.static java.lang.StringEIDS_DEBUGProperty name for eids client log level.static java.lang.StringEIDS_MAX_EVENT_AGEProperty name for eids max server event age.static java.lang.StringEIDS_SERVER_HOST_PROPERTYProperty name for eids server host address.static java.lang.StringEIDS_SERVER_PORTProperty name for eids server port.static java.lang.StringEIDS_TRACKING_FILEProperty name for eids client tracking file.-
Fields inherited from class gov.usgs.earthquake.distribution.DefaultNotificationReceiver
CONNECT_TIMEOUT_PROPERTY, DEFAULT_CONNECT_TIMEOUT, DEFAULT_PRODUCT_STORAGE_MAX_AGE, DEFAULT_READ_TIMEOUT, DEFAULT_RECEIVER_CLEANUP, EXECUTOR_LISTENER_NOTIFIER, FUTURE_LISTENER_NOTIFIER, INDEX_FILE_PROPERTY, LISTENER_NOTIFIER_PROPERTY, NOTIFICATION_INDEX_PROPERTY, PRODUCT_STORAGE_MAX_AGE_PROPERTY, PRODUCT_STORAGE_PROPERTY, READ_TIMEOUT_PROPERTY, RECEIVER_CLEANUP_PROPERTY, ROUNDROBIN_LISTENER_NOTIFIER, STORAGE_DIRECTORY_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description EIDSNotificationReceiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(Config config)Process configuration settings.EIDSClientgetClient()voidonEIDSMessage(EIDSMessageEvent event)Implement the EIDSListener interface to process messages from EIDS.voidsetClient(EIDSClient client)voidshutdown()Stop any processing/background threads.voidstartup()Start any processing/background threads.-
Methods inherited from class gov.usgs.earthquake.distribution.DefaultNotificationReceiver
addNotificationListener, getConnectTimeout, getListenerQueueStatus, getNotificationIndex, getNotifier, getProductStorage, getProductStorageMaxAge, getQueueStatus, getReadTimeout, getReceiverCleanupInterval, notifyListeners, onExpiredNotification, receiveNotification, removeExpiredNotifications, removeNotificationListener, retrieveProduct, sendNotifications, setConnectTimeout, setNotificationIndex, setNotifier, setProductStorage, setProductStorageMaxAge, setReadTimeout, setReceiverCleanupInterval, storeProductSource, throttleQueues
-
Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.usgs.util.Configurable
getName, setName
-
-
-
-
Field Detail
-
EIDS_SERVER_HOST_PROPERTY
public static final java.lang.String EIDS_SERVER_HOST_PROPERTY
Property name for eids server host address.- See Also:
- Constant Field Values
-
EIDS_SERVER_PORT
public static final java.lang.String EIDS_SERVER_PORT
Property name for eids server port.- See Also:
- Constant Field Values
-
EIDS_ALTERNATE_SERVERS
public static final java.lang.String EIDS_ALTERNATE_SERVERS
Property name for eids server alternate servers list.- See Also:
- Constant Field Values
-
EIDS_TRACKING_FILE
public static final java.lang.String EIDS_TRACKING_FILE
Property name for eids client tracking file.- See Also:
- Constant Field Values
-
EIDS_DEBUG
public static final java.lang.String EIDS_DEBUG
Property name for eids client log level.- See Also:
- Constant Field Values
-
EIDS_MAX_EVENT_AGE
public static final java.lang.String EIDS_MAX_EVENT_AGE
Property name for eids max server event age.- See Also:
- Constant Field Values
-
-
Method Detail
-
onEIDSMessage
public void onEIDSMessage(EIDSMessageEvent event)
Implement the EIDSListener interface to process messages from EIDS. Checks to make sure message has Correct namespace and root element before parsing.- Specified by:
onEIDSMessagein interfaceEIDSListener- Parameters:
event- an event object representing the message that was received.
-
configure
public void configure(Config config) throws java.lang.Exception
Description copied from class:DefaultConfigurableProcess configuration settings. Called before startup().- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classDefaultNotificationReceiver- Parameters:
config- the Config object with settings.- Throws:
java.lang.Exception- if configuration exceptions occur.
-
shutdown
public void shutdown() throws java.lang.ExceptionDescription copied from class:DefaultConfigurableStop any processing/background threads.- Specified by:
shutdownin interfaceConfigurable- Overrides:
shutdownin classDefaultNotificationReceiver- Throws:
java.lang.Exception- if exceptions occur while starting.
-
startup
public void startup() throws java.lang.ExceptionDescription copied from class:DefaultConfigurableStart any processing/background threads.- Specified by:
startupin interfaceConfigurable- Overrides:
startupin classDefaultNotificationReceiver- Throws:
java.lang.Exception- if exceptions occur while starting.
-
getClient
public EIDSClient getClient()
- Returns:
- EIDSClient
-
setClient
public void setClient(EIDSClient client)
- Parameters:
client- set EIDSClient
-
-