接口 RSocketRequester
public interface RSocketRequester
A thin wrapper around a sendingRSocketwith a fluent API accepting and returning higher level Objects for input and for output, along with methods to prepare routing and other metadata.- 从以下版本开始:
- 5.2
- 作者:
- Rossen Stoyanchev, Brian Clozel
嵌套类概要
嵌套类 修饰符和类型 接口 说明 static interfaceRSocketRequester.BuilderBuilder to create a requester by connecting to a server.static interfaceRSocketRequester.MetadataSpec<S extends RSocketRequester.MetadataSpec<S>>Spec for providing additional composite metadata entries.static interfaceRSocketRequester.RequestSpecSpec to declare the input for an RSocket request.static interfaceRSocketRequester.RetrieveSpecSpec to declare the expected output for an RSocket request.
方法概要
所有方法 静态方法 实例方法 抽象方法 修饰符和类型 方法 说明 static RSocketRequester.Builderbuilder()Obtain a builder to create a clientRSocketRequesterby connecting to an RSocket server.MimeTypedataMimeType()Return the dataMimeTypeselected for the underlying RSocket at connection time.RSocketRequester.RequestSpecmetadata(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 aPublisherviaReactiveAdapterRegistry.MimeTypemetadataMimeType()Return the metadataMimeTypeselected for the underlying RSocket at connection time.RSocketRequester.RequestSpecroute(String route, Object... routeVars)Begin to specify a new request with the given route to a remote handler.io.rsocket.RSocketrsocket()Return the underlying sending RSocket.static RSocketRequesterwrap(io.rsocket.RSocket rsocket, MimeType dataMimeType, MimeType metadataMimeType, RSocketStrategies strategies)Wrap an existingRSocket.
方法详细资料
rsocket
io.rsocket.RSocket rsocket()
Return the underlying sending RSocket.
dataMimeType
MimeType 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.
metadataMimeType
MimeType 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.
route
RSocketRequester.RequestSpec route(String route, Object... routeVars)
Begin to specify a new request with the given route to a remote handler.The route can be a template with placeholders, e.g.
"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.- 参数:
route- the route expressing a remote handler mappingrouteVars- variables to be expanded into the route template- 返回:
- a spec for further defining and executing the request
metadata
RSocketRequester.RequestSpec metadata(Object metadata, @Nullable 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 aPublisherviaReactiveAdapterRegistry.- 参数:
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 asnull.
builder
static RSocketRequester.Builder builder()
Obtain a builder to create a clientRSocketRequesterby connecting to an RSocket server.
wrap
static RSocketRequester wrap(io.rsocket.RSocket rsocket, MimeType dataMimeType, MimeType metadataMimeType, RSocketStrategies strategies)
Wrap an existingRSocket. Typically used in client or server responders to wrap theRSocketfor the remote side.