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
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
FieldsModifier and TypeFieldDescriptionstatic final String
Property name for eids server alternate servers list.static final String
Property name for eids client log level.static final String
Property name for eids max server event age.static final String
Property name for eids server host address.static final String
Property name for eids server port.static final String
Property 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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
Process configuration settings.boolean
isAlternateServersValid
(String alternateServers) Checks alternateServers configuration parameter for correct syntax - (correct) "host:port, host:port"void
onEIDSMessage
(EIDSMessageEvent event) Implement the EIDSListener interface to process messages from EIDS.void
setClient
(EIDSClient client) void
shutdown()
Stop any processing/background threads.void
startup()
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 Details
-
EIDS_SERVER_HOST_PROPERTY
Property name for eids server host address.- See Also:
-
EIDS_SERVER_PORT
Property name for eids server port.- See Also:
-
EIDS_ALTERNATE_SERVERS
Property name for eids server alternate servers list.- See Also:
-
EIDS_TRACKING_FILE
Property name for eids client tracking file.- See Also:
-
EIDS_DEBUG
Property name for eids client log level.- See Also:
-
EIDS_MAX_EVENT_AGE
Property name for eids max server event age.- See Also:
-
-
Constructor Details
-
EIDSNotificationReceiver
public EIDSNotificationReceiver()
-
-
Method Details
-
onEIDSMessage
Implement the EIDSListener interface to process messages from EIDS. Checks to make sure message has Correct namespace and root element before parsing.- Specified by:
onEIDSMessage
in interfaceEIDSListener
- Parameters:
event
- an event object representing the message that was received.
-
configure
Description copied from class:DefaultConfigurable
Process configuration settings. Called before startup().- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classDefaultNotificationReceiver
- Parameters:
config
- the Config object with settings.- Throws:
Exception
- if configuration exceptions occur.
-
shutdown
Description copied from class:DefaultConfigurable
Stop any processing/background threads.- Specified by:
shutdown
in interfaceConfigurable
- Overrides:
shutdown
in classDefaultNotificationReceiver
- Throws:
Exception
- if exceptions occur while starting.
-
startup
Description copied from class:DefaultConfigurable
Start any processing/background threads.- Specified by:
startup
in interfaceConfigurable
- Overrides:
startup
in classDefaultNotificationReceiver
- Throws:
Exception
- if exceptions occur while starting.
-
isAlternateServersValid
Checks alternateServers configuration parameter for correct syntax - (correct) "host:port, host:port"- Parameters:
alternateServers
- comma separated list of host:port combinations- Returns:
- boolean
-
getClient
- Returns:
- EIDSClient
-
setClient
- Parameters:
client
- set EIDSClient
-