public interface NotificationService
extends com.google.common.util.concurrent.Service
| Modifier and Type | Method and Description |
|---|---|
<N> com.google.common.util.concurrent.ListenableFuture<N> |
publish(co.cask.cdap.proto.id.NotificationFeedId feed,
N notification)
Send one Notification asynchronously.
|
<N> com.google.common.util.concurrent.ListenableFuture<N> |
publish(co.cask.cdap.proto.id.NotificationFeedId feed,
N notification,
Type notificationType)
Send one Notification asynchronously.
|
<N> org.apache.twill.common.Cancellable |
subscribe(co.cask.cdap.proto.id.NotificationFeedId feed,
NotificationHandler<N> handler)
Subscribe to the notification received on the
feed, and handle the notifications with the handler. |
<N> org.apache.twill.common.Cancellable |
subscribe(co.cask.cdap.proto.id.NotificationFeedId feed,
NotificationHandler<N> handler,
Executor executor)
Subscribe to the notification received on the
feed, and handle the notifications with the handler. |
<N> com.google.common.util.concurrent.ListenableFuture<N> publish(co.cask.cdap.proto.id.NotificationFeedId feed,
N notification)
throws NotificationException
notification is used to serialize the message
passed to the Notification system.N - Type of the notification to sendfeed - NotificationFeedId where to publish the notificationnotification - notification object to sendListenableFuture describing the state of the async send operationNotificationFeedException - in case of any error regarding the feedNotificationException - in case of any error when publishing the notification<N> com.google.common.util.concurrent.ListenableFuture<N> publish(co.cask.cdap.proto.id.NotificationFeedId feed,
N notification,
Type notificationType)
throws NotificationException
notificationType is used to serialize the notification
passed to the Notification system.N - Type of the notification to sendfeed - NotificationFeedId where to publish the notificationnotification - notification object to sendnotificationType - type to use to serialize the notification in the Notification systemListenableFuture describing the state of the async send operationNotificationFeedException - in case of any error regarding the feedNotificationException - in case of any error when publishing the notification<N> org.apache.twill.common.Cancellable subscribe(co.cask.cdap.proto.id.NotificationFeedId feed,
NotificationHandler<N> handler)
throws NotificationFeedNotFoundException,
NotificationFeedException
feed, and handle the notifications with the handler.
Before this call is made, the feed has to be created using the
NotificationFeedManager.
Multiple subscriptions to a same feed with different handlers are possible.
This method is calling subscribe(NotificationFeedId, NotificationHandler, Executor) with a same thread
executor. The invocation of the handler is done through one of the Notification service thread, hence
the handler should not be doing long blocking task.N - Type of the notificationsfeed - NotificationFeedId to subscribe tohandler - NotificationHandler that will handle the notifications coming from the feedCancellable for cancelling Notification consumptionNotificationFeedNotFoundException - if the feed does not exist, according to the
NotificationFeedManagerNotificationFeedException - in case of any other error concerning the feed<N> org.apache.twill.common.Cancellable subscribe(co.cask.cdap.proto.id.NotificationFeedId feed,
NotificationHandler<N> handler,
Executor executor)
throws NotificationFeedNotFoundException,
NotificationFeedException
feed, and handle the notifications with the handler.
Before this call is made, the feed has to be created using the
NotificationFeedManager.
Multiple subscriptions to a same feed with different handlers are possible.N - Type of the notificationsfeed - NotificationFeedId to subscribe tohandler - NotificationHandler that will handle the notifications coming from the feedexecutor - Executor to use to perform the polling/pushing of notifications from the Notification
system, and to call the handlerCancellable for cancelling Notification consumptionNotificationFeedNotFoundException - if the feed does not exist, according to the
NotificationFeedManagerNotificationFeedException - in case of any other error concerning the feedCopyright © 2018 Cask Data, Inc. Licensed under the Apache License, Version 2.0.