public interface RSocketRequester
extends reactor.core.Disposable
RSocket
with a fluent API accepting
and returning higher level Objects for input and for output, along with
methods to prepare routing and other metadata.Modifier and Type | Interface and Description |
---|---|
static interface |
RSocketRequester.Builder
Builder to create a requester by connecting to a server.
|
static interface |
RSocketRequester.MetadataSpec<S extends RSocketRequester.MetadataSpec<S>>
Spec for providing additional composite metadata entries.
|
static interface |
RSocketRequester.RequestSpec
Spec to declare the input for an RSocket request.
|
static interface |
RSocketRequester.RetrieveSpec
Spec to declare the expected output for an RSocket request.
|
Modifier and Type | Method and Description |
---|---|
static RSocketRequester.Builder |
builder()
Obtain a builder to create a client
RSocketRequester by connecting
to an RSocket server. |
MimeType |
dataMimeType()
Return the data
MimeType selected for the underlying RSocket
at connection time. |
default void |
dispose()
Shortcut method that delegates to the same on the underlying
rsocketClient() in order to close the connection from the
underlying transport and notify subscribers. |
default boolean |
isDisposed()
Shortcut method that delegates to the same on the underlying
rsocketClient() . |
RSocketRequester.RequestSpec |
metadata(Object metadata,
MimeType mimeType)
Begin to specify a new request with the given metadata value, which can
be a concrete value or any producer of a single value that can be adapted
to a
Publisher via ReactiveAdapterRegistry . |
MimeType |
metadataMimeType()
Return the metadata
MimeType selected for the underlying RSocket
at connection time. |
RSocketRequester.RequestSpec |
route(String route,
Object... routeVars)
Begin to specify a new request with the given route to a remote handler.
|
io.rsocket.RSocket |
rsocket()
Return the underlying
RSocket if the requester was created with a
"live" RSocket via wrap(RSocket, MimeType, MimeType, RSocketStrategies)
or via one of the (deprecated) connect methods on the
RSocketRequester builder, or otherwise return null . |
io.rsocket.core.RSocketClient |
rsocketClient()
Return the underlying
RSocketClient used to make requests with. |
static RSocketRequester |
wrap(io.rsocket.RSocket rsocket,
MimeType dataMimeType,
MimeType metadataMimeType,
RSocketStrategies strategies)
Wrap an existing
RSocket . |
io.rsocket.core.RSocketClient rsocketClient()
RSocketClient
used to make requests with.@Nullable io.rsocket.RSocket rsocket()
RSocket
if the requester was created with a
"live" RSocket via wrap(RSocket, MimeType, MimeType, RSocketStrategies)
or via one of the (deprecated) connect methods on the
RSocketRequester
builder, or otherwise return null
.MimeType dataMimeType()
MimeType
selected for the underlying RSocket
at connection time. On the client side this is configured via
RSocketRequester.Builder.dataMimeType(MimeType)
while on the
server side it's obtained from the ConnectionSetupPayload
.MimeType metadataMimeType()
MimeType
selected for the underlying RSocket
at connection time. On the client side this is configured via
RSocketRequester.Builder.metadataMimeType(MimeType)
while on the
server side it's obtained from the ConnectionSetupPayload
.RSocketRequester.RequestSpec route(String route, Object... routeVars)
The route can be a template with placeholders, e.g.
"flight.{code}"
in which case the supplied route variables are
formatted via toString()
and expanded into the template.
If a formatted variable contains a "." it is replaced with the escape
sequence "%2E" to avoid treating it as separator by the responder .
If the connection is set to use composite metadata, the route is
encoded as "message/x.rsocket.routing.v0"
. Otherwise the route
is encoded according to the mime type for the connection.
route
- the route expressing a remote handler mappingrouteVars
- variables to be expanded into the route templateRSocketRequester.RequestSpec metadata(Object metadata, @Nullable MimeType mimeType)
Publisher
via ReactiveAdapterRegistry
.metadata
- the metadata value to encodemimeType
- the mime type that describes the metadata;
This is required for connection using composite metadata. Otherwise the
value is encoded according to the mime type for the connection and this
argument may be left as null
.default void dispose()
rsocketClient()
in order to close the connection from the
underlying transport and notify subscribers.dispose
in interface reactor.core.Disposable
default boolean isDisposed()
rsocketClient()
.isDisposed
in interface reactor.core.Disposable
static RSocketRequester.Builder builder()
RSocketRequester
by connecting
to an RSocket server.static RSocketRequester wrap(io.rsocket.RSocket rsocket, MimeType dataMimeType, MimeType metadataMimeType, RSocketStrategies strategies)
RSocket
. Typically for internal framework use,
to wrap the remote RSocket
in a client or server responder, but
it can also be used to wrap any RSocket
.