T
- ClientTransport implementationCONF
- Client Configuration implementationpublic abstract class ClientTransport<T extends ClientTransport<T,CONF>,CONF extends ClientTransportConfig<CONF>> extends Transport<T,CONF>
Constructor and Description |
---|
ClientTransport() |
Modifier and Type | Method and Description |
---|---|
protected Mono<? extends Connection> |
connect()
|
protected Connection |
connectNow()
Block the
ClientTransport and return a Connection . |
protected Connection |
connectNow(java.time.Duration timeout)
Block the
ClientTransport and return a Connection . |
T |
doAfterResolve(java.util.function.BiConsumer<? super Connection,? super SocketAddress> doAfterResolve)
Set or add a callback called after
SocketAddress is resolved successfully. |
T |
doOnConnect(java.util.function.Consumer<? super CONF> doOnConnect)
Set or add a callback called when
ClientTransport is about to connect to the remote endpoint. |
T |
doOnConnected(java.util.function.Consumer<? super Connection> doOnConnected)
Set or add a callback called after
Connection has been connected. |
T |
doOnDisconnected(java.util.function.Consumer<? super Connection> doOnDisconnected)
Set or add a callback called after
Connection has been disconnected. |
T |
doOnResolve(java.util.function.Consumer<? super Connection> doOnResolve)
Set or add a callback called before
SocketAddress is resolved. |
T |
doOnResolveError(java.util.function.BiConsumer<? super Connection,? super Throwable> doOnResolveError)
Set or add a callback called if an exception happens while resolving to a
SocketAddress . |
T |
host(String host)
The host to which this client should connect.
|
T |
noProxy()
Remove any previously applied Proxy configuration customization
|
T |
port(int port)
The port to which this client should connect.
|
T |
proxy(java.util.function.Consumer<? super ProxyProvider.TypeSpec> proxyOptions)
Apply a proxy configuration
|
T |
remoteAddress(java.util.function.Supplier<? extends SocketAddress> remoteAddressSupplier)
The address to which this client should connect on each subscribe.
|
T |
resolver(AddressResolverGroup<?> resolver)
Assign an
AddressResolverGroup . |
T |
resolver(java.util.function.Consumer<NameResolverProvider.NameResolverSpec> nameResolverSpec)
Apply a name resolver configuration.
|
T |
runOn(LoopResources loopResources,
boolean preferNative)
Run IO loops on a supplied
EventLoopGroup from the LoopResources container. |
Mono<Void> |
warmup()
Based on the actual configuration, returns a
Mono that triggers:
an initialization of the event loop group
an initialization of the host name resolver
loads the necessary native libraries for the transport
By default, when method is not used, the connect operation absorbs the extra time needed to initialize and
load the resources. |
attr, bindAddress, channelGroup, configuration, doOnChannelInit, duplicate, metrics, metrics, observe, option, runOn, runOn, wiretap, wiretap, wiretap, wiretap, wiretap
protected Mono<? extends Connection> connect()
ClientTransport
and return a Mono
of Connection
. If
Mono
is cancelled, the underlying connection will be aborted. Once the
Connection
has been emitted and is not necessary anymore, disposing must be
done by the user via DisposableChannel.dispose()
.Mono
of Connection
protected Connection connectNow()
ClientTransport
and return a Connection
. Disposing must be
done by the user via DisposableChannel.dispose()
. The max connection
timeout is 45 seconds.Connection
protected Connection connectNow(java.time.Duration timeout)
ClientTransport
and return a Connection
. Disposing must be
done by the user via DisposableChannel.dispose()
.timeout
- connect timeout (resolution: ns)Connection
public T doOnConnect(java.util.function.Consumer<? super CONF> doOnConnect)
ClientTransport
is about to connect to the remote endpoint.doOnConnect
- a consumer observing connect eventsClientTransport
referencepublic T doOnConnected(java.util.function.Consumer<? super Connection> doOnConnected)
Connection
has been connected.doOnConnected
- a consumer observing connected eventsClientTransport
referencepublic T doOnDisconnected(java.util.function.Consumer<? super Connection> doOnDisconnected)
Connection
has been disconnected.doOnDisconnected
- a consumer observing disconnected eventsClientTransport
referencepublic final T doOnResolve(java.util.function.Consumer<? super Connection> doOnResolve)
SocketAddress
is resolved.doOnResolve
- a consumer observing resolve eventsClientTransport
referencepublic final T doAfterResolve(java.util.function.BiConsumer<? super Connection,? super SocketAddress> doAfterResolve)
SocketAddress
is resolved successfully.doAfterResolve
- a consumer observing resolved eventsClientTransport
referencepublic final T doOnResolveError(java.util.function.BiConsumer<? super Connection,? super Throwable> doOnResolveError)
SocketAddress
.doOnResolveError
- a consumer observing resolve error eventsClientTransport
referencepublic T host(String host)
host
- the host to connect toClientTransport
referencepublic T noProxy()
ClientTransport
referencepublic T port(int port)
port
- the port to connect toClientTransport
referencepublic T proxy(java.util.function.Consumer<? super ProxyProvider.TypeSpec> proxyOptions)
proxyOptions
- the proxy configuration callbackClientTransport
referencepublic T remoteAddress(java.util.function.Supplier<? extends SocketAddress> remoteAddressSupplier)
remoteAddressSupplier
- A supplier of the address to connect to.ClientTransport
public T resolver(AddressResolverGroup<?> resolver)
AddressResolverGroup
.resolver
- the new AddressResolverGroup
ClientTransport
referencepublic T resolver(java.util.function.Consumer<NameResolverProvider.NameResolverSpec> nameResolverSpec)
nameResolverSpec
- the name resolver callbackClientTransport
referencepublic T runOn(LoopResources loopResources, boolean preferNative)
Transport
EventLoopGroup
from the LoopResources
container.runOn
in class Transport<T extends ClientTransport<T,CONF>,CONF extends ClientTransportConfig<CONF>>
loopResources
- a new loop resourcespreferNative
- should prefer running on epoll, kqueue or similar instead of java NIOTransport
referencepublic Mono<Void> warmup()
Mono
that triggers:
connect operation
absorbs the extra time needed to initialize and
load the resources.Mono
representing the completion of the warmup