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
ConstructorsConstructorDescriptionNotificationServiceImpl(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 aNotificationServiceimplementation. -
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 aNotificationServiceimplementation.- 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.UNLIMITEDorDuration.ZEROto disable.heartbeatExecutor-ScheduledExecutorServiceused to schedule heartbeat tasksrenewalDelay- delay between connection renewals. Set toDuration.UNLIMITEDorDuration.ZEROto disable.tracingProvider- TheTracingProviderto use when working with AM.
-
-
Method Details
-
start
Description copied from interface:LifeCycleStarts this object. -
stop
Description copied from interface:LifeCycleStops this object. -
subscribe
public Promise<Subscription,SubscriptionException> subscribe(String topic, NotificationListener listener) Description copied from interface:NotificationServiceSubscribes (asynchronously) to a given topic, providing a listener that will be invoked at notification reception time.- Specified by:
subscribein 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:NotificationServiceRegisters asynchronously a listener that will be notified on connection/disconnection events. The returnedPromisewill be completed once theNotificationServiceis connected.- Specified by:
addConnectionEventListenerin interfaceNotificationService- Parameters:
listener- consumer of connection events- Returns:
- a promise of a registration object that has to be used for un-registration
-