接口 RSocketRequester.Builder
- 封闭接口:
- RSocketRequester
public static interface RSocketRequester.Builder
Builder to create a requester by connecting to a server.
方法概要
所有方法 实例方法 抽象方法 已过时的方法 修饰符和类型 方法 说明 RSocketRequester.Builder
apply(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.Builder
dataMimeType(MimeType mimeType)
Configure the payload data MimeType to specify on theSETUP
frame that applies to the whole connection.RSocketRequester.Builder
metadataMimeType(MimeType mimeType)
Configure the payload metadata MimeType to specify on theSETUP
frame that applies to the whole connection.RSocketRequester.Builder
rsocketConnector(RSocketConnectorConfigurer configurer)
Callback to configure theRSocketConnector
directly.RSocketRequester.Builder
rsocketFactory(ClientRSocketFactoryConfigurer configurer)
已过时。as of 5.2.6 following the deprecation ofRSocketFactory.ClientRSocketFactory
in RSocket 1.0 RC7.RSocketRequester.Builder
rsocketStrategies(Consumer<RSocketStrategies.Builder> configurer)
Customize theRSocketStrategies
.RSocketRequester.Builder
rsocketStrategies(RSocketStrategies strategies)
Provide theRSocketStrategies
to use.RSocketRequester.Builder
setupData(Object data)
Set the data for the setup payload.RSocketRequester.Builder
setupMetadata(Object value, MimeType mimeType)
Add metadata entry to the setup payload.RSocketRequester.Builder
setupRoute(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 theSETUP
frame that applies to the whole connection.If not set, this will be initialized to the MimeType of the first
non-default
Decoder
, or otherwise the MimeType of the first decoder.
metadataMimeType
RSocketRequester.Builder metadataMimeType(MimeType mimeType)
Configure the payload metadata MimeType to specify on theSETUP
frame 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 aPublisher
viaReactiveAdapterRegistry
.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 aPublisher
viaReactiveAdapterRegistry
.
rsocketStrategies
RSocketRequester.Builder rsocketStrategies(@Nullable RSocketStrategies strategies)
Provide theRSocketStrategies
to 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 theRSocketConnector
directly.- The data and metadata mime types cannot be set directly on the
RSocketConnector
and 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.ClientRSocketFactory
in RSocket 1.0 RC7. Please, usersocketConnector(RSocketConnectorConfigurer)
.Callback to configure theClientRSocketFactory
directly.- The data and metadata mime types cannot be set directly on the
ClientRSocketFactory
and 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
RSocketRequester
for 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
RSocketRequester
for 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
RSocketRequester
for the connection