public static class RSocketFactory.ClientRSocketFactory extends Object implements RSocketFactory.ClientTransportAcceptor
| Constructor and Description |
|---|
ClientRSocketFactory() |
ClientRSocketFactory(RSocketConnector connector) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittransportpublic ClientRSocketFactory()
public ClientRSocketFactory(RSocketConnector connector)
public RSocketFactory.ClientRSocketFactory byteBufAllocator(ByteBufAllocator allocator)
ByteBufAllocator it is recommended to use the
following setup for Reactor Netty based transport:
TcpClient.create()
...
.bootstrap(bootstrap -> bootstrap.option(ChannelOption.ALLOCATOR, clientAllocator))
TcpServer.create()
...
.bootstrap(serverBootstrap -> serverBootstrap.childOption(ChannelOption.ALLOCATOR, serverAllocator))
Or in case of local transport, to use corresponding factory method LocalClientTransport.creat(String, ByteBufAllocator)allocator - instance of ByteBufAllocatorpublic RSocketFactory.ClientRSocketFactory addConnectionPlugin(DuplexConnectionInterceptor interceptor)
@Deprecated public RSocketFactory.ClientRSocketFactory addClientPlugin(RSocketInterceptor interceptor)
addRequesterPlugin(RSocketInterceptor) insteadpublic RSocketFactory.ClientRSocketFactory addRequesterPlugin(RSocketInterceptor interceptor)
@Deprecated public RSocketFactory.ClientRSocketFactory addServerPlugin(RSocketInterceptor interceptor)
addResponderPlugin(RSocketInterceptor) insteadpublic RSocketFactory.ClientRSocketFactory addResponderPlugin(RSocketInterceptor interceptor)
public RSocketFactory.ClientRSocketFactory addSocketAcceptorPlugin(SocketAcceptorInterceptor interceptor)
@Deprecated public RSocketFactory.ClientRSocketFactory keepAlive()
public RSocketFactory.ClientTransportAcceptor keepAlive(Duration tickPeriod, Duration ackTimeout, int missedAcks)
public RSocketFactory.ClientRSocketFactory keepAliveTickPeriod(Duration tickPeriod)
public RSocketFactory.ClientRSocketFactory keepAliveAckTimeout(Duration ackTimeout)
public RSocketFactory.ClientRSocketFactory keepAliveMissedAcks(int missedAcks)
public RSocketFactory.ClientRSocketFactory mimeType(String metadataMimeType, String dataMimeType)
public RSocketFactory.ClientRSocketFactory dataMimeType(String dataMimeType)
public RSocketFactory.ClientRSocketFactory metadataMimeType(String metadataMimeType)
public RSocketFactory.ClientRSocketFactory lease(Supplier<Leases<? extends LeaseStats>> supplier)
public RSocketFactory.ClientRSocketFactory lease()
@Deprecated public RSocketFactory.ClientRSocketFactory singleSubscriberRequester()
public RSocketFactory.ClientRSocketFactory reconnect(Retry retrySpec)
Mono<RSocket> so every subscriber will
observe the same RSocket instance up on connection establishment.
Mono<RSocket> sharedRSocketMono =
RSocketFactory
.connect()
.reconnect(Retry.fixedDelay(3, Duration.ofSeconds(1)))
.transport(transport)
.start();
RSocket r1 = sharedRSocketMono.block();
RSocket r2 = sharedRSocketMono.block();
assert r1 == r2;
Apart of the shared behavior, if the connection is lost, the same Mono<RSocket>
instance will transparently re-establish the connection for subsequent subscribers.
Mono<RSocket> sharedRSocketMono =
RSocketFactory
.connect()
.reconnect(Retry.fixedDelay(3, Duration.ofSeconds(1)))
.transport(transport)
.start();
RSocket r1 = sharedRSocketMono.block();
RSocket r2 = sharedRSocketMono.block();
assert r1 == r2;
r1.dispose()
assert r2.isDisposed()
RSocket r3 = sharedRSocketMono.block();
RSocket r4 = sharedRSocketMono.block();
assert r1 != r3;
assert r4 == r3;
Note, having reconnect() enabled does not eliminate the need to accompany each
individual request with the corresponding retry logic.
Mono<RSocket> sharedRSocketMono =
RSocketFactory
.connect()
.reconnect(Retry.fixedDelay(3, Duration.ofSeconds(1)))
.transport(transport)
.start();
sharedRSocket.flatMap(rSocket -> rSocket.requestResponse(...))
.retryWhen(ownRetry)
.subscribe()
retrySpec - a retry factory applied for Mono.retryWhen(Retry)Mono<RSocket>.public RSocketFactory.ClientRSocketFactory resume()
public RSocketFactory.ClientRSocketFactory resumeToken(Supplier<ByteBuf> supplier)
public RSocketFactory.ClientRSocketFactory resumeStore(Function<? super ByteBuf,? extends ResumableFramesStore> storeFactory)
public RSocketFactory.ClientRSocketFactory resumeSessionDuration(Duration sessionDuration)
public RSocketFactory.ClientRSocketFactory resumeStreamTimeout(Duration streamTimeout)
public RSocketFactory.ClientRSocketFactory resumeStrategy(Supplier<ResumeStrategy> strategy)
public RSocketFactory.ClientRSocketFactory resumeCleanupOnKeepAlive()
public RSocketFactory.Start<RSocket> transport(Supplier<ClientTransport> transport)
transport in interface RSocketFactory.ClientTransportAcceptorpublic RSocketFactory.ClientTransportAcceptor acceptor(Function<RSocket,RSocket> acceptor)
public RSocketFactory.ClientTransportAcceptor acceptor(Supplier<Function<RSocket,RSocket>> acceptorSupplier)
public RSocketFactory.ClientTransportAcceptor acceptor(SocketAcceptor acceptor)
public RSocketFactory.ClientRSocketFactory fragment(int mtu)
public RSocketFactory.ClientRSocketFactory errorConsumer(Consumer<Throwable> errorConsumer)
public RSocketFactory.ClientRSocketFactory setupPayload(Payload payload)
public RSocketFactory.ClientRSocketFactory frameDecoder(PayloadDecoder payloadDecoder)