Package gov.usgs.earthquake.distribution
Interface NotificationListener
- All Superinterfaces:
Configurable
- All Known Implementing Classes:
ContentListener
,DefaultNotificationListener
,DefaultNotificationSender
,DYFIIndexerWedge
,EIDSNotificationSender
,EIDSOutputWedge
,ExternalNotificationListener
,FileTrackingListener
,HeartbeatListener
,Indexer
,NATSStreamingNotificationSender
,RelayProductListener
,ShakeMapIndexerWedge
Process Notifications of Products.
NotificationListeners receive Notifications from NotificationReceivers.
First, a listener registers with a NotificationReceiver using the
addNotificationListener method:
receiver.addNotificationListener(listener);A listener may "search" previous notifications using the NotificationReceiver's sendNotifications method.
-
Method Summary
Modifier and TypeMethodDescriptionint
A NotificationReceiver that generates a NotificationEvent will attempt to deliver the event up to this many times, if the listener throws an Exception while processing.long
A NotificationListener has this many milliseconds to process a notification before being interrupted.void
onNotification
(NotificationEvent event) Receive a Notification that a product is available.
-
Method Details
-
onNotification
Receive a Notification that a product is available. If this NotificationListener is interested in the Product, it may use the convenience method getProduct():Product product = event.getProduct();
When getTimeout() returns a positive (>0) number of milliseconds, the thread calling onNotification may be interrupted. Listeners should use care in handling InterruptedExceptions to ensure resources are properly freed.- Parameters:
event
- the event corresponding to the notification that is available.- Throws:
ContinuableListenerException
- if redelivery should be attempted (depending on what getAttemptCount() returns).Exception
- See Also:
-
getMaxTries
int getMaxTries()A NotificationReceiver that generates a NotificationEvent will attempt to deliver the event up to this many times, if the listener throws an Exception while processing.- Returns:
- A value of 1 or less means do not attempt more than once.
-
getTimeout
long getTimeout()A NotificationListener has this many milliseconds to process a notification before being interrupted.- Returns:
- number of milliseconds before timing out. A value of 0 or less means never time out.
-