public class ReactorNettyTcpClient<P> extends Object implements TcpOperations<P>
TcpOperations.| Constructor and Description |
|---|
ReactorNettyTcpClient(Consumer<reactor.ipc.netty.options.ClientOptions.Builder<?>> optionsConsumer,
ReactorNettyCodec<P> codec)
Constructor with a
ClientOptions.Builder that can be used to
customize Reactor Netty client options. |
ReactorNettyTcpClient(String host,
int port,
ReactorNettyCodec<P> codec)
Simple constructor with a host and a port.
|
ReactorNettyTcpClient(reactor.ipc.netty.tcp.TcpClient tcpClient,
ReactorNettyCodec<P> codec)
Constructor with an externally created
TcpClient instance whose
lifecycle is expected to be managed externally. |
| Modifier and Type | Method and Description |
|---|---|
ListenableFuture<Void> |
connect(TcpConnectionHandler<P> handler)
Open a new connection.
|
ListenableFuture<Void> |
connect(TcpConnectionHandler<P> handler,
ReconnectStrategy strategy)
Open a new connection and a strategy for reconnecting if the connection fails.
|
ListenableFuture<Void> |
shutdown()
Shut down and close any open connections.
|
String |
toString() |
public ReactorNettyTcpClient(String host, int port, ReactorNettyCodec<P> codec)
host - the host to connect toport - the port to connect tocodec - the code to useStompReactorNettyCodecpublic ReactorNettyTcpClient(Consumer<reactor.ipc.netty.options.ClientOptions.Builder<?>> optionsConsumer, ReactorNettyCodec<P> codec)
ClientOptions.Builder that can be used to
customize Reactor Netty client options.
Note: this constructor manages the lifecycle of the
TcpClient and its underlying resources. Please do not customize
any of the following options:
ClientOptions.Builder#channelGroup(ChannelGroup) ChannelGroup,
ClientOptions.Builder#loopResources(LoopResources) LoopResources, and
ClientOptions.Builder#poolResources(PoolResources) PoolResources.
You may set the ClientOptions.Builder#disablePool() disablePool
option if you simply want to turn off pooling.
For full control over the initialization and lifecycle of the TcpClient,
see ReactorNettyTcpClient(TcpClient, ReactorNettyCodec).
optionsConsumer - consumer to customize client optionscodec - the code to useStompReactorNettyCodecpublic ReactorNettyTcpClient(reactor.ipc.netty.tcp.TcpClient tcpClient,
ReactorNettyCodec<P> codec)
TcpClient instance whose
lifecycle is expected to be managed externally.tcpClient - the TcpClient instance to usecodec - the code to useStompReactorNettyCodecpublic ListenableFuture<Void> connect(TcpConnectionHandler<P> handler)
TcpOperationsconnect in interface TcpOperations<P>handler - a handler to manage the connectionpublic ListenableFuture<Void> connect(TcpConnectionHandler<P> handler, ReconnectStrategy strategy)
TcpOperationsconnect in interface TcpOperations<P>handler - a handler to manage the connectionstrategy - a strategy for reconnectingpublic ListenableFuture<Void> shutdown()
TcpOperationsshutdown in interface TcpOperations<P>