接口 RSocketRequester.Builder
- 封闭接口:
- RSocketRequester
public static interface RSocketRequester.Builder
Builder to create a requester by connecting to a server.
方法概要
所有方法 实例方法 抽象方法 已过时的方法 修饰符和类型 方法 说明 RSocketRequester.Builderapply(Consumer<RSocketRequester.Builder> configurer)Configure this builder through aConsumer.reactor.core.publisher.Mono<RSocketRequester>connect(io.rsocket.transport.ClientTransport transport)Connect to the server with the givenClientTransport.reactor.core.publisher.Mono<RSocketRequester>connectTcp(String host, int port)Connect to the server over TCP.reactor.core.publisher.Mono<RSocketRequester>connectWebSocket(URI uri)Connect to the server over WebSocket.RSocketRequester.BuilderdataMimeType(MimeType mimeType)Configure the payload data MimeType to specify on theSETUPframe that applies to the whole connection.RSocketRequester.BuildermetadataMimeType(MimeType mimeType)Configure the payload metadata MimeType to specify on theSETUPframe that applies to the whole connection.RSocketRequester.BuilderrsocketConnector(RSocketConnectorConfigurer configurer)Callback to configure theRSocketConnectordirectly.RSocketRequester.BuilderrsocketFactory(ClientRSocketFactoryConfigurer configurer)已过时。as of 5.2.6 following the deprecation ofRSocketFactory.ClientRSocketFactoryin RSocket 1.0 RC7.RSocketRequester.BuilderrsocketStrategies(Consumer<RSocketStrategies.Builder> configurer)Customize theRSocketStrategies.RSocketRequester.BuilderrsocketStrategies(RSocketStrategies strategies)Provide theRSocketStrategiesto use.RSocketRequester.BuildersetupData(Object data)Set the data for the setup payload.RSocketRequester.BuildersetupMetadata(Object value, MimeType mimeType)Add metadata entry to the setup payload.RSocketRequester.BuildersetupRoute(String route, Object... routeVars)Set the route for the setup payload.
方法详细资料
dataMimeType
RSocketRequester.Builder dataMimeType(@Nullable MimeType mimeType)
Configure the payload data MimeType to specify on theSETUPframe that applies to the whole connection.If not set, this will be initialized to the MimeType of the first
non-defaultDecoder, or otherwise the MimeType of the first decoder.
metadataMimeType
RSocketRequester.Builder metadataMimeType(MimeType mimeType)
Configure the payload metadata MimeType to specify on theSETUPframe that applies to the whole connection.By default this is set to
"message/x.rsocket.composite-metadata.v0"in which case the route, if provided, is encoded as a"message/x.rsocket.routing.v0"composite metadata entry. If this is set to any other MimeType, it is assumed that's the MimeType for the route, if provided.
setupData
RSocketRequester.Builder setupData(Object data)
Set the data for the setup payload. The data will be encoded according to the configureddataMimeType(MimeType). The data be a concrete value or any producer of a single value that can be adapted to aPublisherviaReactiveAdapterRegistry.By default this is not set.
setupRoute
RSocketRequester.Builder setupRoute(String route, Object... routeVars)
Set the route for the setup payload. The rules for formatting and encoding the route are the same as those for a request route as described inRSocketRequester.route(String, Object...).By default this is not set.
setupMetadata
RSocketRequester.Builder setupMetadata(Object value, @Nullable MimeType mimeType)
Add metadata entry to the setup payload. Composite metadata must be in use if this is called more than once or in addition tosetupRoute(String, Object...). The metadata value be a concrete value or any producer of a single value that can be adapted to aPublisherviaReactiveAdapterRegistry.
rsocketStrategies
RSocketRequester.Builder rsocketStrategies(@Nullable RSocketStrategies strategies)
Provide theRSocketStrategiesto use.This is useful for changing the default settings, yet still allowing further customizations via
rsocketStrategies(Consumer). If not set, defaults are obtained fromRSocketStrategies.builder().- 参数:
strategies- the strategies to use
rsocketStrategies
RSocketRequester.Builder rsocketStrategies(Consumer<RSocketStrategies.Builder> configurer)
Customize theRSocketStrategies.Allows further customization on
RSocketStrategies, mutating them if they wereset, or starting fromRSocketStrategies.builder()defaults}.
rsocketConnector
RSocketRequester.Builder rsocketConnector(RSocketConnectorConfigurer configurer)
Callback to configure theRSocketConnectordirectly.- The data and metadata mime types cannot be set directly on the
RSocketConnectorand will be overridden. Use the shortcutsdataMimeType(MimeType)andmetadataMimeType(MimeType)on this builder instead. - The frame decoder also cannot be set directly and instead is set to match the configured
DataBufferFactory. - For the
setupPayload, consider using methods on this builder to specify the route, other metadata, and data as Object values to be encoded. - To configure client side responding, see
RSocketMessageHandler.responder(RSocketStrategies, Object...).
- 从以下版本开始:
- 5.2.6
- The data and metadata mime types cannot be set directly on the
rsocketFactory
@Deprecated RSocketRequester.Builder rsocketFactory(ClientRSocketFactoryConfigurer configurer)
已过时。as of 5.2.6 following the deprecation ofRSocketFactory.ClientRSocketFactoryin RSocket 1.0 RC7. Please, usersocketConnector(RSocketConnectorConfigurer).Callback to configure theClientRSocketFactorydirectly.- The data and metadata mime types cannot be set directly on the
ClientRSocketFactoryand will be overridden. Use the shortcutsdataMimeType(MimeType)andmetadataMimeType(MimeType)on this builder instead. - The frame decoder also cannot be set directly and instead is set to match the configured
DataBufferFactory. - For the
setupPayload, consider using methods on this builder to specify the route, other metadata, and data as Object values to be encoded. - To configure client side responding, see
RSocketMessageHandler.clientResponder(RSocketStrategies, Object...).
- The data and metadata mime types cannot be set directly on the
apply
RSocketRequester.Builder apply(Consumer<RSocketRequester.Builder> configurer)
Configure this builder through aConsumer. This enables libraries such as Spring Security to provide shortcuts for applying a set of related customizations.- 参数:
configurer- the configurer to apply
connectTcp
reactor.core.publisher.Mono<RSocketRequester> connectTcp(String host, int port)
Connect to the server over TCP.- 参数:
host- the server hostport- the server port- 返回:
- an
RSocketRequesterfor the connection - 另请参阅:
TcpClientTransport
connectWebSocket
reactor.core.publisher.Mono<RSocketRequester> connectWebSocket(URI uri)
Connect to the server over WebSocket.- 参数:
uri- the RSocket server endpoint URI- 返回:
- an
RSocketRequesterfor the connection - 另请参阅:
WebsocketClientTransport
connect
reactor.core.publisher.Mono<RSocketRequester> connect(io.rsocket.transport.ClientTransport transport)
Connect to the server with the givenClientTransport.- 参数:
transport- the client transport to use- 返回:
- an
RSocketRequesterfor the connection