Interface RSocketRequester
- All Superinterfaces:
- reactor.core.Disposable
public interface RSocketRequester
extends reactor.core.Disposable
A thin wrapper around a sending 
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.- Since:
- 5.2
- Author:
- Rossen Stoyanchev, Brian Clozel
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder to create a requester by connecting to a server.static interfaceSpec for providing additional composite metadata entries.static interfaceSpec to declare the input for an RSocket request.static interfaceSpec to declare the expected output for an RSocket request.Nested classes/interfaces inherited from interface reactor.core.Disposablereactor.core.Disposable.Composite, reactor.core.Disposable.Swap
- 
Method SummaryModifier and TypeMethodDescriptionstatic RSocketRequester.Builderbuilder()Obtain a builder to create a clientRSocketRequesterby connecting to an RSocket server.Return the dataMimeTypeselected for the underlying RSocket at connection time.default voiddispose()Shortcut method that delegates to the same on the underlyingrsocketClient()in order to close the connection from the underlying transport and notify subscribers.default booleanShortcut method that delegates to the same on the underlyingrsocketClient().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 aPublisherviaReactiveAdapterRegistry.Return the metadataMimeTypeselected for the underlying RSocket at connection time.Begin to specify a new request with the given route to a remote handler.@Nullable io.rsocket.RSocketrsocket()Return the underlyingRSocketif the requester was created with a "live" RSocket viawrap(RSocket, MimeType, MimeType, RSocketStrategies)or via one of the (deprecated) connect methods on theRSocketRequesterbuilder, or otherwise returnnull.io.rsocket.core.RSocketClientReturn the underlyingRSocketClientused to make requests with.Return the configuredRSocketStrategies.static RSocketRequesterwrap(io.rsocket.RSocket rsocket, MimeType dataMimeType, MimeType metadataMimeType, RSocketStrategies strategies) Wrap an existingRSocket.
- 
Method Details- 
rsocketClientio.rsocket.core.RSocketClient rsocketClient()Return the underlyingRSocketClientused to make requests with.- Since:
- 5.3
 
- 
rsocket@Nullable io.rsocket.RSocket rsocket()Return the underlyingRSocketif the requester was created with a "live" RSocket viawrap(RSocket, MimeType, MimeType, RSocketStrategies)or via one of the (deprecated) connect methods on theRSocketRequesterbuilder, or otherwise returnnull.
- 
dataMimeTypeMimeType dataMimeType()Return the dataMimeTypeselected for the underlying RSocket at connection time. On the client side this is configured viaRSocketRequester.Builder.dataMimeType(MimeType)while on the server side it's obtained from theConnectionSetupPayload.
- 
metadataMimeTypeMimeType metadataMimeType()Return the metadataMimeTypeselected for the underlying RSocket at connection time. On the client side this is configured viaRSocketRequester.Builder.metadataMimeType(MimeType)while on the server side it's obtained from theConnectionSetupPayload.
- 
strategiesRSocketStrategies strategies()Return the configuredRSocketStrategies.
- 
routeBegin to specify a new request with the given route to a remote handler.The route can be a template with placeholders, for example, "flight.{code}"in which case the supplied route variables are formatted viatoString()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.- Parameters:
- route- the route expressing a remote handler mapping
- routeVars- variables to be expanded into the route template
- Returns:
- a spec for further defining and executing the request
 
- 
metadataBegin 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 aPublisherviaReactiveAdapterRegistry.- Parameters:
- metadata- the metadata value to encode
- mimeType- 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.
 
- 
disposedefault void dispose()Shortcut method that delegates to the same on the underlyingrsocketClient()in order to close the connection from the underlying transport and notify subscribers.- Specified by:
- disposein interface- reactor.core.Disposable
- Since:
- 5.3.7
 
- 
isDisposeddefault boolean isDisposed()Shortcut method that delegates to the same on the underlyingrsocketClient().- Specified by:
- isDisposedin interface- reactor.core.Disposable
- Since:
- 5.3.7
 
- 
builderObtain a builder to create a clientRSocketRequesterby connecting to an RSocket server.
- 
wrapstatic RSocketRequester wrap(io.rsocket.RSocket rsocket, MimeType dataMimeType, MimeType metadataMimeType, RSocketStrategies strategies) Wrap an existingRSocket. Typically for internal framework use, to wrap the remoteRSocketin a client or server responder, but it can also be used to wrap anyRSocket.
 
-