Class WebSocketAdapterConfiguration
- java.lang.Object
- 
- org.forgerock.openig.tools.notifications.ws.WebSocketAdapterConfiguration
 
- 
 public class WebSocketAdapterConfiguration extends Object A configuration holder to instantiateWebSocketAdapter.
- 
- 
Constructor SummaryConstructors Constructor Description WebSocketAdapterConfiguration(URI uri, List<String> subProtocols)Create an instance of aWebSocketAdapterConfiguration.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description WebSocketAdapterConfigurationcloseHandler(Consumer<Void> closeHandler)Supply a close handler executed once the client websocket connection being closed.WebSocketAdapterConfigurationexceptionHandler(Consumer<Throwable> exceptionHandler)Supply an exception handler capable of consuming websocket exceptions.Consumer<Void>getCloseHandler()The close handler (guaranteed to be notnull).Consumer<Throwable>getExceptionHandler()The exception handler (guaranteed to be notnull).StringgetHeaderName()The SSO header name.ScheduledExecutorServicegetHeartbeatExecutorService()The executor service to use to schedule heartbeat tasks.DurationgetHeartbeatInterval()The interval between heartbeats.intgetInitialConnectionAttempts()The number of retries allowed for the first connection.Consumer<JsonValue>getMessageHandler()The message handler (guaranteed to be notnull).Consumer<WebSocketAdapter>getOpenHandler()The open handler (guaranteed to be notnull).DurationgetReconnectDelay()The delay after which a reconnect will be attempted.List<String>getSubProtocols()The subProtocols list to support (guaranteed to be notnull).AsyncRefreshableSupplier<SsoToken,AuthenticationException>getTokenProvider()The SSO token value provider.URIgetUri()The Websocket remote endpoint URI (guaranteed to be notnull).WebSocketAdapterConfigurationheartbeat(Duration interval, ScheduledExecutorService executorService)Supply The heartbeat setup to keep the websocket session busy.WebSocketAdapterConfigurationmessageHandler(Consumer<JsonValue> messageHandler)Supply a message handler capable of consuming server requests.WebSocketAdapterConfigurationopenHandler(Consumer<WebSocketAdapter> openHandler)Supply an open handler executed once the websocket connection is established and completed.WebSocketAdapterConfigurationreconnect(Duration reconnectDelay, int initialConnectionAttempts)Supply reconnect configuration to support reconnection attempts should the websocket be terminated remotely.WebSocketAdapterConfigurationssoHeader(String headerName, AsyncRefreshableSupplier<SsoToken,AuthenticationException> tokenProvider)Provide values for a SSO token header.
 
- 
- 
- 
Method Detail- 
openHandlerpublic WebSocketAdapterConfiguration openHandler(Consumer<WebSocketAdapter> openHandler) Supply an open handler executed once the websocket connection is established and completed. The handler is called once on the connection being successfully established and on any successful reconnections.- Parameters:
- openHandler- the open handler (not- null)
- Returns:
- thisinstance supporting a fluent API
 
 - 
closeHandlerpublic WebSocketAdapterConfiguration closeHandler(Consumer<Void> closeHandler) Supply a close handler executed once the client websocket connection being closed. That is, if the websocket is closed using itsWebSocketAdapter.close()method then this handler will be executed on completion. It is not called on remote websocket disconnections or exceptions.- Parameters:
- closeHandler- the close handler (not- null)
- Returns:
- thisinstance supporting a fluent API
 
 - 
messageHandlerpublic WebSocketAdapterConfiguration messageHandler(Consumer<JsonValue> messageHandler) Supply a message handler capable of consuming server requests. The handler is called on receipt of a message on the websocket.- Parameters:
- messageHandler- the message handler (not- null)
- Returns:
- thisinstance supporting a fluent API
 
 - 
exceptionHandlerpublic WebSocketAdapterConfiguration exceptionHandler(Consumer<Throwable> exceptionHandler) Supply an exception handler capable of consuming websocket exceptions. The exception handler is called in the event of exceptions on the websocket and after reconnection attempts have failed.- Parameters:
- exceptionHandler- the exception handler (not- null)
- Returns:
- thisinstance supporting a fluent API
 
 - 
ssoHeaderpublic WebSocketAdapterConfiguration ssoHeader(String headerName, AsyncRefreshableSupplier<SsoToken,AuthenticationException> tokenProvider) Provide values for a SSO token header.- Parameters:
- headerName- The SSO header name (not- null)
- tokenProvider- The SSO token value provider (not- null)
- Returns:
- thisinstance supporting a fluent API
 
 - 
reconnectpublic WebSocketAdapterConfiguration reconnect(Duration reconnectDelay, int initialConnectionAttempts) Supply reconnect configuration to support reconnection attempts should the websocket be terminated remotely. This includes constraining the reconnection attempts to execute with a delay of reconnectDelay.- Parameters:
- reconnectDelay- the delay after which a reconnect will be attempted (not- null)
- initialConnectionAttempts- the number of retries allowed for the first connection
- Returns:
- thisinstance supporting a fluent API
 
 - 
heartbeatpublic WebSocketAdapterConfiguration heartbeat(Duration interval, ScheduledExecutorService executorService) Supply The heartbeat setup to keep the websocket session busy.- Parameters:
- interval- the interval between heartbeats.- nullis an invalid value,- Duration.UNLIMITEDand- Duration.ZEROrepresent no heartbeat.
- executorService- the executor service to use to schedule heartbeat tasks.
- Returns:
- thisinstance supporting a fluent API
 
 - 
getUripublic URI getUri() The Websocket remote endpoint URI (guaranteed to be notnull).- Returns:
- The Websocket remote endpoint URI (guaranteed to be not null)
 
 - 
getOpenHandlerpublic Consumer<WebSocketAdapter> getOpenHandler() The open handler (guaranteed to be notnull).- Returns:
- The open handler (guaranteed to be not null)
 
 - 
getCloseHandlerpublic Consumer<Void> getCloseHandler() The close handler (guaranteed to be notnull).- Returns:
- The close handler (guaranteed to be not null)
 
 - 
getMessageHandlerpublic Consumer<JsonValue> getMessageHandler() The message handler (guaranteed to be notnull).- Returns:
- The message handler (guaranteed to be not null)
 
 - 
getExceptionHandlerpublic Consumer<Throwable> getExceptionHandler() The exception handler (guaranteed to be notnull).- Returns:
- The exception handler (guaranteed to be not null)
 
 - 
getSubProtocolspublic List<String> getSubProtocols() The subProtocols list to support (guaranteed to be notnull).- Returns:
- the subProtocols list to support (guaranteed to be not null)
 
 - 
getReconnectDelaypublic Duration getReconnectDelay() The delay after which a reconnect will be attempted.- Returns:
- The delay after which a reconnect will be attempted
 
 - 
getInitialConnectionAttemptspublic int getInitialConnectionAttempts() The number of retries allowed for the first connection.- Returns:
- The number of retries allowed for the first connection
 
 - 
getHeaderNamepublic String getHeaderName() The SSO header name.- Returns:
- The SSO header name
 
 - 
getTokenProviderpublic AsyncRefreshableSupplier<SsoToken,AuthenticationException> getTokenProvider() The SSO token value provider.- Returns:
- The SSO token value provider
 
 - 
getHeartbeatExecutorServicepublic ScheduledExecutorService getHeartbeatExecutorService() The executor service to use to schedule heartbeat tasks.- Returns:
- The executor service to use to schedule heartbeat tasks.
 
 - 
getHeartbeatIntervalpublic Duration getHeartbeatInterval() The interval between heartbeats.Duration.UNLIMITEDandDuration.ZEROrepresent no heartbeat.- Returns:
- The interval between heartbeats.
 
 
- 
 
-