Interface NotificationService
-
- All Known Implementing Classes:
NotificationServiceImpl
,SubscriptionService
public interface NotificationService
Represents a source of notifications.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
NotificationService.Registration
Represents the connection event listener registration.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Promise<NotificationService.Registration,NeverThrowsException>
addConnectionEventListener(Consumer<ConnectionEvent> listener)
Registers asynchronously a listener that will be notified on connection/disconnection events.Promise<Subscription,SubscriptionException>
subscribe(String topic, NotificationListener listener)
Subscribes (asynchronously) to a given topic, providing a listener that will be invoked at notification reception time.
-
-
-
Method Detail
-
subscribe
Promise<Subscription,SubscriptionException> subscribe(String topic, NotificationListener listener)
Subscribes (asynchronously) to a given topic, providing a listener that will be invoked at notification reception time.- Parameters:
topic
- topic name to subscribe tolistener
- notification listener- Returns:
- a promise of a subscription that will be completed after AM sends back the acknowledgement.
-
addConnectionEventListener
Promise<NotificationService.Registration,NeverThrowsException> addConnectionEventListener(Consumer<ConnectionEvent> listener)
Registers asynchronously a listener that will be notified on connection/disconnection events. The returnedPromise
will be completed once theNotificationService
is connected.- Parameters:
listener
- consumer of connection events- Returns:
- a promise of a registration object that has to be used for un-registration
-
-