public class LoadBalancingClient
extends io.reactivesocket.client.AbstractReactiveSocketClient
ReactiveSocketClient that operates on a cluster of target servers instead of a single
server.| Modifier and Type | Class and Description |
|---|---|
static class |
LoadBalancingClient.SourceToClient<T>
A mapping function from a collection of any type to a collection of
ReactiveSocketClient. |
| Constructor and Description |
|---|
LoadBalancingClient(io.reactivesocket.client.LoadBalancerInitializer initializer) |
| Modifier and Type | Method and Description |
|---|---|
double |
availability() |
org.reactivestreams.Publisher<? extends io.reactivesocket.ReactiveSocket> |
connect() |
static <T> LoadBalancingClient |
create(org.reactivestreams.Publisher<? extends java.util.Collection<T>> servers,
java.util.function.Function<T,io.reactivesocket.client.ReactiveSocketClient> clientFactory)
Creates a client that will load balance on the active servers as provided by the passed
servers. |
cancel, getEventListener, isEventPublishingEnabled, subscribepublic LoadBalancingClient(io.reactivesocket.client.LoadBalancerInitializer initializer)
public org.reactivestreams.Publisher<? extends io.reactivesocket.ReactiveSocket> connect()
public double availability()
public static <T> LoadBalancingClient create(org.reactivestreams.Publisher<? extends java.util.Collection<T>> servers, java.util.function.Function<T,io.reactivesocket.client.ReactiveSocketClient> clientFactory)
servers. A
server provided by this stream will be converted to a ReactiveSocketClient using the passed
clientFactory.T - Type of the server.servers - Stream of a collection of active servers. Every emission on this stream must contain all active
servers. This client does not collect servers over multiple emissions.clientFactory - A function to convert a server to ReactiveSocketClientLoadBalancingClient.