For using TCP using default settings:
import io.rsocket.transport.netty.client.TcpClientTransport;
Mono<RSocket> source =
RSocketConnector.connectWith(TcpClientTransport.create("localhost", 7000));
RSocketClient client = RSocketClient.from(source);
To customize connection settings before connecting:
Mono<RSocket> source =
RSocketConnector.create()
.metadataMimeType("message/x.rsocket.composite-metadata.v0")
.dataMimeType("application/cbor")
.connect(TcpClientTransport.create("localhost", 7000));
RSocketClient client = RSocketClient.from(source);
| Modifier and Type | Field and Description |
|---|---|
| private SocketAcceptor | |
| private static final String | |
| private String | |
| private InitializingInterceptorRegistry | |
| private static final BiConsumer | |
| private Duration | |
| private Duration | |
| private Consumer | |
| private int | |
| private String | |
| private int | |
| private PayloadDecoder | |
| private Resume | |
| private Retry | |
| private Mono |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public RSocketConnector | Returns: the same instance for method chainingthe acceptor to use for responding to server requests acceptor)Configure a client-side |
| public Mono | Returns: aMono with the connected RSocketthe transport of choice to connect with transport)Connect with the given transport and obtain a live |
| public Mono | Returns: aMono with the connected RSocketsupplier for the transport to connect with transportSupplier)Variant of |
| public static Mono | Returns: aMono with the connected RSocketthe transport of choice to connect with transport)Static factory method to connect with default settings, effectively a shortcut for: RSocketConnector.create().connect(transport); |
| public static RSocketConnector | create()
Static factory method to create an |
| public RSocketConnector | Returns: the same instance for method chainingthe MIME type to be used for payload data dataMimeType)Set the MIME type to use for formatting payload data on the established connection. |
| public RSocketConnector | Returns: the same instance for method chainingthe threshold size for fragmentation, must be no less than 64 mtu)When this is set, frames larger than the given maximum transmission unit (mtu) size value are broken down into fragments to fit that size. |
| public RSocketConnector | Returns: the same instance for method chaininga configurer to customize interception with. configurer)Configure interception at one of the following levels:
|
| public RSocketConnector | Returns: the same instance for method chaininghow frequently to emit KEEPALIVE frames interval, Duration how long to allow between maxLifeTime)KEEPALIVE frames from the remote end
before assuming that connectivity is lost; the value should be generous and allow for
multiple missed KEEPALIVE frames.Set the "Time Between |
| public RSocketConnector | Returns: the same instance for method chainingEnables the Lease feature of the RSocket protocol where the number of requests that can be
performed from either side are rationed via |
| public RSocketConnector | Returns: the same instance for method chainingconsumer which accepts leaseConfigurer)LeaseSpec and use it for configuringEnables the Lease feature of the RSocket protocol where the number of requests that can be
performed from either side are rationed via |
| public RSocketConnector | Returns: the same instance for method chainingthe threshold size for reassembly, must no be less than 64 bytes.
Please note, maxInboundPayloadSize)maxInboundPayloadSize must always be greater or equal to io., otherwise inbound frame can exceed the
maxInboundPayloadSizeWhen this is set, frames reassembler control maximum payload size which can be reassembled. |
| public RSocketConnector | Returns: the same instance for method chainingthe MIME type to be used for payload metadata metadataMimeType)Set the MIME type to use for formatting payload metadata on the established connection. |
| public RSocketConnector | Returns: the same instance for method chainingthe decoder to use decoder)Configure the |
| public RSocketConnector | Returns: the same instance for method chaininga retry spec that declares the rules for reconnecting retry)When this is enabled, the connect methods of this class return a special
|
| public RSocketConnector | |
| public RSocketConnector | Returns: the same instance for method chainingthe payload with data and/or metadata for the setupPayloadMono)SETUP frame.Provide a |
| public RSocketConnector | Returns: the same instance for method chainingthe payload with data and/or metadata for the payload)SETUP frame.Variant of |
| acceptor | back to summary |
|---|---|
| private SocketAcceptor acceptor
| |
| CLIENT_TAG | back to summary |
|---|---|
| private static final String CLIENT_TAG | |
| dataMimeType | back to summary |
|---|---|
| private String dataMimeType | |
| interceptors | back to summary |
|---|---|
| private InitializingInterceptorRegistry interceptors | |
| INVALIDATE_FUNCTION | back to summary |
|---|---|
| private static final BiConsumer<RSocket, Invalidatable> INVALIDATE_FUNCTION | |
| keepAliveInterval | back to summary |
|---|---|
| private Duration keepAliveInterval | |
| keepAliveMaxLifeTime | back to summary |
|---|---|
| private Duration keepAliveMaxLifeTime | |
| leaseConfigurer | back to summary |
|---|---|
| private Consumer<LeaseSpec> leaseConfigurer
| |
| maxInboundPayloadSize | back to summary |
|---|---|
| private int maxInboundPayloadSize | |
| metadataMimeType | back to summary |
|---|---|
| private String metadataMimeType | |
| mtu | back to summary |
|---|---|
| private int mtu | |
| payloadDecoder | back to summary |
|---|---|
| private PayloadDecoder payloadDecoder | |
| resume | back to summary |
|---|---|
| private Resume resume | |
| retrySpec | back to summary |
|---|---|
| private Retry retrySpec | |
| setupPayloadMono | back to summary |
|---|---|
| private Mono<Payload> setupPayloadMono | |
| RSocketConnector | back to summary |
|---|---|
| private RSocketConnector() | |
| acceptor | back to summary |
|---|---|
| public RSocketConnector acceptor(SocketAcceptor acceptor) Configure a client-side A full-form example with access to the
A shortcut example with just the handling RSocket:
A shortcut example handling only request-response:
By default,
| |
| connect | back to summary |
|---|---|
| public Mono Connect with the given transport and obtain a live The following transports are available through additional RSocket Java modules:
| |
| connect | back to summary |
|---|---|
| public Mono Variant of // TODO: when to use?
| |
| connectWith | back to summary |
|---|---|
| public static Mono Static factory method to connect with default settings, effectively a shortcut for: RSocketConnector.create().connect(transport);
| |
| create | back to summary |
|---|---|
| public static RSocketConnector create() Static factory method to create an | |
| dataMimeType | back to summary |
|---|---|
| public RSocketConnector dataMimeType(String dataMimeType) Set the MIME type to use for formatting payload data on the established connection. This is set
in the initial By default this is set to
| |
| fragment | back to summary |
|---|---|
| public RSocketConnector fragment(int mtu) When this is set, frames larger than the given maximum transmission unit (mtu) size value are broken down into fragments to fit that size. By default this is not set in which case payloads are sent whole up to the maximum frame size of 16,777,215 bytes.
| |
| interceptors | back to summary |
|---|---|
| public RSocketConnector interceptors(Consumer<InterceptorRegistry> configurer) Configure interception at one of the following levels:
| |
| keepAlive | back to summary |
|---|---|
| public RSocketConnector keepAlive(Duration interval, Duration maxLifeTime) Set the "Time Between
By default these are set to 20 seconds and 90 seconds respectively.
| |
| lease | back to summary |
|---|---|
| public RSocketConnector lease() Enables the Lease feature of the RSocket protocol where the number of requests that can be
performed from either side are rationed via Example usage:
By default this is not enabled.
| |
| lease | back to summary |
|---|---|
| public RSocketConnector lease(Consumer<LeaseSpec> leaseConfigurer) Enables the Lease feature of the RSocket protocol where the number of requests that can be
performed from either side are rationed via Example usage:
By default this is not enabled.
| |
| maxInboundPayloadSize | back to summary |
|---|---|
| public RSocketConnector maxInboundPayloadSize(int maxInboundPayloadSize) When this is set, frames reassembler control maximum payload size which can be reassembled. By default this is not set in which case maximum reassembled payloads size is not controlled.
| |
| metadataMimeType | back to summary |
|---|---|
| public RSocketConnector metadataMimeType(String metadataMimeType) Set the MIME type to use for formatting payload metadata on the established connection. This is
set in the initial For metadata encoding, consider using one of the following encoders: For more on the above metadata formats, see the corresponding protocol extensions By default this is set to
| |
| payloadDecoder | back to summary |
|---|---|
| public RSocketConnector payloadDecoder(PayloadDecoder decoder) Configure the
By default this is set to
| |
| reconnect | back to summary |
|---|---|
| public RSocketConnector reconnect(Retry retry) When this is enabled, the connect methods of this class return a special
The
Downstream subscribers for individual requests still need their own retry logic to determine if or when failed requests should be retried which in turn triggers the shared reconnect: Note this feature is mutually exclusive with By default this is not enabled in which case a new connection is obtained per subscriber.
| |
| resume | back to summary |
|---|---|
| public RSocketConnector resume(Resume resume) Enables the Resume capability of the RSocket protocol where if the client gets disconnected, the connection is re-acquired and any interrupted streams are resumed automatically. For this to work the server must also support and have the Resume capability enabled. See Note this feature is mutually exclusive with By default this is not enabled.
| |
| setupPayload | back to summary |
|---|---|
| public RSocketConnector setupPayload(Mono<Payload> setupPayloadMono) Provide a
| |
| setupPayload | back to summary |
|---|---|
| public RSocketConnector setupPayload(Payload payload) Variant of Note if the given payload is
| |