Class NotificationServiceImpl
java.lang.Object
org.forgerock.openig.tools.notifications.ws.NotificationServiceImpl
- All Implemented Interfaces:
LifeCycle
,NotificationService
NotificationService
implementation.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.forgerock.openig.tools.notifications.NotificationService
NotificationService.Registration
-
Constructor Summary
ConstructorDescriptionNotificationServiceImpl
(HttpWebSocketClient client, URI uri, String ssoTokenHeader, AsyncRefreshableSupplier<SsoToken, AuthenticationException> tokenProvider, Duration reconnectDelay, int initialConnectionAttempts, Duration heartbeatInterval, ScheduledExecutorService heartbeatExecutor, Duration renewalDelay, org.forgerock.openig.tracing.TracingProvider tracingProvider) Constructs aNotificationService
implementation. -
Method Summary
Modifier and TypeMethodDescriptionaddConnectionEventListener
(Consumer<ConnectionEvent> listener) Registers asynchronously a listener that will be notified on connection/disconnection events.start()
Starts this object.stop()
Stops this object.subscribe
(String topic, NotificationListener listener) Subscribes (asynchronously) to a given topic, providing a listener that will be invoked at notification reception time.
-
Constructor Details
-
NotificationServiceImpl
public NotificationServiceImpl(HttpWebSocketClient client, URI uri, String ssoTokenHeader, AsyncRefreshableSupplier<SsoToken, AuthenticationException> tokenProvider, Duration reconnectDelay, int initialConnectionAttempts, Duration heartbeatInterval, ScheduledExecutorService heartbeatExecutor, Duration renewalDelay, org.forgerock.openig.tracing.TracingProvider tracingProvider) Constructs aNotificationService
implementation.- Parameters:
client
- websocket clienturi
- URI to connect tossoTokenHeader
- SSO token headertokenProvider
- SSO token value providerreconnectDelay
- reconnection delay between attemptsinitialConnectionAttempts
- number of retries allowed for the first connectionheartbeatInterval
- delay between heartbeats. Set toDuration.UNLIMITED
orDuration.ZERO
to disable.heartbeatExecutor
-ScheduledExecutorService
used to schedule heartbeat tasksrenewalDelay
- delay between connection renewals. Set toDuration.UNLIMITED
orDuration.ZERO
to disable.tracingProvider
- TheTracingProvider
to use when working with AM.
-
-
Method Details
-
start
Description copied from interface:LifeCycle
Starts this object. -
stop
Description copied from interface:LifeCycle
Stops this object. -
subscribe
public Promise<Subscription,SubscriptionException> subscribe(String topic, NotificationListener listener) Description copied from interface:NotificationService
Subscribes (asynchronously) to a given topic, providing a listener that will be invoked at notification reception time.- Specified by:
subscribe
in interfaceNotificationService
- 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
public Promise<NotificationService.Registration,NeverThrowsException> addConnectionEventListener(Consumer<ConnectionEvent> listener) Description copied from interface:NotificationService
Registers asynchronously a listener that will be notified on connection/disconnection events. The returnedPromise
will be completed once theNotificationService
is connected.- Specified by:
addConnectionEventListener
in interfaceNotificationService
- Parameters:
listener
- consumer of connection events- Returns:
- a promise of a registration object that has to be used for un-registration
-