Class TCPIOClient<T>
java.lang.Object
org.openremote.agent.protocol.io.AbstractNettyIOClient<T,InetSocketAddress>
org.openremote.agent.protocol.tcp.TCPIOClient<T>
- All Implemented Interfaces:
IOClient<T>
,NettyIOClient<T>
This is a
IOClient
implementation for TCP.
Users of this IOClient
are responsible for adding encoders for converting messages of type <T> to
ByteBuf
(see AbstractNettyIOClient.MessageToByteEncoder
) and adding decoders to convert from
ByteBuf
to messages of type <T> and ensuring these decoded messages are passed back
to this client via AbstractNettyIOClient.onMessageReceived(T)
(see AbstractNettyIOClient.ByteToMessageDecoder
and
AbstractNettyIOClient.MessageToMessageDecoder
).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openremote.agent.protocol.io.AbstractNettyIOClient
AbstractNettyIOClient.ByteToMessageDecoder<T>, AbstractNettyIOClient.MessageToByteEncoder<T>, AbstractNettyIOClient.MessageToMessageDecoder<T>
-
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected Class<? extends io.netty.channel.Channel>
Should return a URI that uniquely identifies this client instanceprotected io.netty.channel.EventLoopGroup
Start the actual connection and return a future indicating completion state.Methods inherited from class org.openremote.agent.protocol.io.AbstractNettyIOClient
addConnectionStatusConsumer, addEncodersDecoders, addMessageConsumer, connect, disconnect, doConnect, doDisconnect, doReconnect, getConnectionStatus, getConnectTimeoutMillis, initChannel, onConnectionStatusChanged, onDecodeException, onEncodeException, onMessageReceived, removeAllConnectionStatusConsumers, removeAllMessageConsumers, removeConnectionStatusConsumer, removeMessageConsumer, scheduleDoConnect, sendMessage, setConnectTimeoutMillis, setEncoderDecoderProvider, toCompletableFuture, toString, waitForConnectFuture
-
Field Details
-
host
-
port
protected int port
-
-
Constructor Details
-
TCPIOClient
-
-
Method Details
-
getChannelClass
- Specified by:
getChannelClass
in classAbstractNettyIOClient<T,
InetSocketAddress>
-
getClientUri
Description copied from interface:IOClient
Should return a URI that uniquely identifies this client instance -
getWorkerGroup
protected io.netty.channel.EventLoopGroup getWorkerGroup()- Specified by:
getWorkerGroup
in classAbstractNettyIOClient<T,
InetSocketAddress>
-
startChannel
Description copied from class:AbstractNettyIOClient
Start the actual connection and return a future indicating completion state. Implementors can also add any custom connection logic they require.- Specified by:
startChannel
in classAbstractNettyIOClient<T,
InetSocketAddress>
-
configureChannel
protected void configureChannel()- Overrides:
configureChannel
in classAbstractNettyIOClient<T,
InetSocketAddress>
-