Package gov.usgs.earthquake.distribution
Class RelayProductListener
- java.lang.Object
-
- gov.usgs.util.DefaultConfigurable
-
- gov.usgs.earthquake.product.AbstractListener
-
- gov.usgs.earthquake.distribution.DefaultNotificationListener
-
- gov.usgs.earthquake.distribution.RelayProductListener
-
- All Implemented Interfaces:
NotificationIndexCleanup.Listener
,NotificationListener
,Configurable
public class RelayProductListener extends DefaultNotificationListener
Listen for products and use a product sender (SocketProductSender by default) to send products as they are received.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SENDER_TYPE_AWS
property saying the sender type is awsstatic java.lang.String
SENDER_TYPE_PROPERTY
property for senderType-
Fields inherited from class gov.usgs.earthquake.distribution.DefaultNotificationListener
CLEANUP_INTERVAL_PROPERTY, CONCURRENT_PRODUCTS_PROPERTY, DEFAULT_CLEANUP_INTERVAL, DEFAULT_CONCURRENT_PRODUCTS, DEFAULT_PROCESS_DUPLICATES, EXCLUDE_PATHS_PROPERTY, INCLUDE_PATHS_PROPERTY, INDEX_FILE_PROPERTY, NOTIFICATION_INDEX_PROPERTY, PROCESS_DUPLICATES
-
Fields inherited from class gov.usgs.earthquake.product.AbstractListener
ATTEMPT_COUNT_PROPERTY, DEFAULT_ATTEMPT_COUNT, DEFAULT_RETRY_DELAY, DEFAULT_TIMEOUT, EXCLUDE_SOURCES_PROPERTY, EXCLUDE_TYPES_PROPERTY, INCLUDE_ACTUALS_PROPERTY, INCLUDE_DEVELOPMENTS_PROPERTY, INCLUDE_INTERNALS_PROPERTY, INCLUDE_SCENARIOS_PROPERTY, INCLUDE_SOURCES_PROPERTY, INCLUDE_TESTS_PROPERTY, INCLUDE_TYPES_PROPERTY, MAX_TRIES_PROPERTY, RETRY_DELAY_PROPERTY, TIMEOUT_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description RelayProductListener()
Empty constructor for configurable, will configure as a SocketProductSender.RelayProductListener(ProductSender sender)
Construct a RelayProductListener using a custom ProductSender.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Config config)
Creates a SocketProductSender and uses its configure method.void
onProduct(Product product)
Send a product.void
setName(java.lang.String name)
Set this object name.void
shutdown()
Call the sender shutdown method.void
startup()
Call the sender startup method.-
Methods inherited from class gov.usgs.earthquake.distribution.DefaultNotificationListener
cleanup, getCleanupInterval, getConcurrentProducts, getExcludePaths, getIncludePaths, getNotificationIndex, isProcessDuplicates, onAfterProcessNotification, onBeforeProcessNotification, onBeforeProcessProduct, onExpiredNotification, onNotification, setCleanupInterval, setConcurrentProducts, setNotificationIndex, setProcessDuplicates
-
Methods inherited from class gov.usgs.earthquake.product.AbstractListener
accept, getExcludeSources, getExcludeTypes, getIncludeSources, getIncludeTypes, getMaxTries, getRetryDelay, getTimeout, isIncludeActuals, isIncludeDevelopments, isIncludeInternals, isIncludeScenarios, isIncludeTests, setIncludeActuals, setIncludeDevelopments, setIncludeInternals, setIncludeScenarios, setIncludeTests, setMaxTries, setRetryDelay, setTimeout
-
Methods inherited from class gov.usgs.util.DefaultConfigurable
getName
-
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
-
Methods inherited from interface gov.usgs.earthquake.distribution.NotificationListener
getMaxTries, getTimeout
-
-
-
-
Field Detail
-
SENDER_TYPE_PROPERTY
public static final java.lang.String SENDER_TYPE_PROPERTY
property for senderType- See Also:
- Constant Field Values
-
SENDER_TYPE_AWS
public static final java.lang.String SENDER_TYPE_AWS
property saying the sender type is aws- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RelayProductListener
public RelayProductListener()
Empty constructor for configurable, will configure as a SocketProductSender.
-
RelayProductListener
public RelayProductListener(ProductSender sender)
Construct a RelayProductListener using a custom ProductSender.- Parameters:
sender
- the sender to use.
-
-
Method Detail
-
onProduct
public void onProduct(Product product)
Send a product.- Overrides:
onProduct
in classDefaultNotificationListener
- Parameters:
product
- a product whose notification was accepted.
-
configure
public void configure(Config config) throws java.lang.Exception
Creates a SocketProductSender and uses its configure method.- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classDefaultNotificationListener
- Parameters:
config
- the Config object with settings.- Throws:
java.lang.Exception
- if configuration exceptions occur.
-
setName
public void setName(java.lang.String name)
Description copied from interface:Configurable
Set this object name. This method is typically called by a Config object when the configurable object is loaded out of a config file. name will be set to the config section.- Specified by:
setName
in interfaceConfigurable
- Overrides:
setName
in classDefaultConfigurable
- Parameters:
name
- the name.
-
shutdown
public void shutdown() throws java.lang.Exception
Call the sender shutdown method.- Specified by:
shutdown
in interfaceConfigurable
- Overrides:
shutdown
in classDefaultNotificationListener
- Throws:
java.lang.Exception
- if exceptions occur while starting.
-
startup
public void startup() throws java.lang.Exception
Call the sender startup method.- Specified by:
startup
in interfaceConfigurable
- Overrides:
startup
in classDefaultNotificationListener
- Throws:
java.lang.Exception
- if exceptions occur while starting.
-
-