Interface NotificationService
- All Known Implementing Classes:
NotificationServiceImpl
public interface NotificationService
Represents a source of notifications.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Represents the connection event listener registration. -
Method Summary
Modifier and TypeMethodDescriptionaddConnectionEventListener
(Consumer<ConnectionEvent> listener) Registers asynchronously a listener that will be notified on connection/disconnection events.subscribe
(String topic, NotificationListener listener) Subscribes (asynchronously) to a given topic, providing a listener that will be invoked at notification reception time.
-
Method Details
-
subscribe
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
-