Class GatewayIOClient

java.lang.Object
org.openremote.agent.protocol.io.AbstractNettyIOClient<String,InetSocketAddress>
org.openremote.agent.protocol.websocket.WebsocketIOClient<String>
org.openremote.manager.gateway.GatewayIOClient
All Implemented Interfaces:
org.openremote.agent.protocol.io.IOClient<String>, org.openremote.agent.protocol.io.NettyIOClient<String>

public class GatewayIOClient extends org.openremote.agent.protocol.websocket.WebsocketIOClient<String>
This is a special version of WebsocketIOClient that waits for a GatewayCapabilitiesRequestEvent from the central manager before completing the connected future; this means that synchronisation failures will be handled with exponential backoff. If no event is received within TIMEOUT_MILLIS then it is assumed the connection is ready as we could be talking to an old central manager that doesn't emit the event.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.openremote.agent.protocol.io.AbstractNettyIOClient

    org.openremote.agent.protocol.io.AbstractNettyIOClient.ByteToMessageDecoder<T>, org.openremote.agent.protocol.io.AbstractNettyIOClient.MessageToByteEncoder<T>, org.openremote.agent.protocol.io.AbstractNettyIOClient.MessageToMessageDecoder<T>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    protected static final int
     

    Fields inherited from class org.openremote.agent.protocol.websocket.WebsocketIOClient

    client, handler, handshakeFuture, headers, host, oAuthGrant, PING_MILLIS, PING_TIMEOUT_MILLIS, pingDisabled, pingFuture, port, sslCtx, uri, useSsl

    Fields inherited from class org.openremote.agent.protocol.io.AbstractNettyIOClient

    bootstrap, channel, connectionStatus, connectionStatusConsumers, connectRetry, connectTimeout, encoderDecoderProvider, executorService, messageConsumers, RECONNECT_DELAY_INITIAL_MILLIS, RECONNECT_DELAY_MAX_MILLIS, scheduledExecutorService, workerGroup
  • Constructor Summary

    Constructors
    Constructor
    Description
    GatewayIOClient(URI uri, Map<String,List<String>> headers, org.openremote.model.auth.OAuthGrant oAuthGrant)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    protected void
     
    protected Future<Void>
     
    protected Void
     

    Methods inherited from class org.openremote.agent.protocol.websocket.WebsocketIOClient

    addEncodersDecoders, doDisconnect, getAuthHeader, getChannelClass, getClient, getClientUri, getSSLContext, getWorkerGroup, onHandshakeDone

    Methods inherited from class org.openremote.agent.protocol.io.AbstractNettyIOClient

    addConnectionStatusConsumer, addMessageConsumer, configureChannel, connect, disconnect, doConnect, doReconnect, getConnectionStatus, getConnectTimeoutMillis, initChannel, onConnectionStatusChanged, onDecodeException, onEncodeException, removeAllConnectionStatusConsumers, removeAllMessageConsumers, removeConnectionStatusConsumer, removeMessageConsumer, scheduleDoConnect, sendMessage, setConnectTimeoutMillis, setEncoderDecoderProvider, toCompletableFuture, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • GatewayIOClient

      public GatewayIOClient(URI uri, Map<String,List<String>> headers, org.openremote.model.auth.OAuthGrant oAuthGrant)
  • Method Details

    • startChannel

      protected Future<Void> startChannel()
      Overrides:
      startChannel in class org.openremote.agent.protocol.websocket.WebsocketIOClient<String>
    • waitForConnectFuture

      protected Void waitForConnectFuture(Future<Void> connectFuture) throws Exception
      Overrides:
      waitForConnectFuture in class org.openremote.agent.protocol.io.AbstractNettyIOClient<String,InetSocketAddress>
      Throws:
      Exception
    • getFuture

      protected CompletableFuture<Void> getFuture()
    • onMessageReceived

      protected void onMessageReceived(String message)
      Overrides:
      onMessageReceived in class org.openremote.agent.protocol.io.AbstractNettyIOClient<String,InetSocketAddress>