Interface RSocketRequester.Builder
- Enclosing interface:
- RSocketRequester
-
Method Summary
Modifier and TypeMethodDescriptionapply
(Consumer<RSocketRequester.Builder> configurer) Configure this builder through aConsumer
.reactor.core.publisher.Mono<RSocketRequester>
connect
(io.rsocket.transport.ClientTransport transport) Deprecated.reactor.core.publisher.Mono<RSocketRequester>
connectTcp
(String host, int port) Deprecated.as of 5.3 in favor oftcp(String, int)
reactor.core.publisher.Mono<RSocketRequester>
connectWebSocket
(URI uri) Deprecated.as of 5.3 in favor ofwebsocket(URI)
dataMimeType
(MimeType mimeType) Configure the payload data MimeType to specify on theSETUP
frame that applies to the whole connection.metadataMimeType
(MimeType mimeType) Configure the payload metadata MimeType to specify on theSETUP
frame that applies to the whole connection.rsocketConnector
(RSocketConnectorConfigurer configurer) Callback to configure theRSocketConnector
directly.rsocketStrategies
(Consumer<RSocketStrategies.Builder> configurer) Customize theRSocketStrategies
.rsocketStrategies
(RSocketStrategies strategies) Provide theRSocketStrategies
to use.Set the data for the setup payload.setupMetadata
(Object value, MimeType mimeType) Add metadata entry to the setup payload.setupRoute
(String route, Object... routeVars) Set the route for the setup payload.Build anRSocketRequester
with anRSocketClient
that connects over TCP to the given host and port.transport
(io.rsocket.transport.ClientTransport transport) transports
(Publisher<List<io.rsocket.loadbalance.LoadbalanceTarget>> targetPublisher, io.rsocket.loadbalance.LoadbalanceStrategy loadbalanceStrategy) Build anRSocketRequester
with anLoadbalanceRSocketClient
that will connect to one of the given targets selected through the givenLoadbalanceRSocketClient
.Build anRSocketRequester
with anRSocketClient
that connects over WebSocket to the given URL.
-
Method Details
-
dataMimeType
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
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
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
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
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
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()
.- Parameters:
strategies
- the strategies to use
-
rsocketStrategies
Customize theRSocketStrategies
.Allows further customization on
RSocketStrategies
, mutating them if they wereset
, or starting fromRSocketStrategies.builder()
defaults}. -
rsocketConnector
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...)
.
- Since:
- 5.2.6
- The data and metadata mime types cannot be set directly
on the
-
apply
Configure this builder through aConsumer
. This enables libraries such as Spring Security to provide shortcuts for applying a set of related customizations.- Parameters:
configurer
- the configurer to apply
-
tcp
Build anRSocketRequester
with anRSocketClient
that connects over TCP to the given host and port. The requester can be used to make requests concurrently. Requests are made over a shared connection that is also re-established as needed when further requests are made.- Parameters:
host
- the host to connect toport
- the port to connect to- Returns:
- the created
RSocketRequester
- Since:
- 5.3
-
websocket
Build anRSocketRequester
with anRSocketClient
that connects over WebSocket to the given URL. The requester can be used to make requests concurrently. Requests are made over a shared connection that is also re-established as needed when further requests are made.- Parameters:
uri
- the URL to connect to- Returns:
- the created
RSocketRequester
- Since:
- 5.3
-
transport
- Parameters:
transport
- the transport to connect with- Returns:
- the created
RSocketRequester
- Since:
- 5.3
-
transports
RSocketRequester transports(Publisher<List<io.rsocket.loadbalance.LoadbalanceTarget>> targetPublisher, io.rsocket.loadbalance.LoadbalanceStrategy loadbalanceStrategy) Build anRSocketRequester
with anLoadbalanceRSocketClient
that will connect to one of the given targets selected through the givenLoadbalanceRSocketClient
.- Parameters:
targetPublisher
- aPublisher
that supplies a list of target transports to loadbalance against; the given list may be periodically updated by thePublisher
.loadbalanceStrategy
- the strategy to use for selecting from the list of loadbalance targets.- Returns:
- the created
RSocketRequester
- Since:
- 5.3
-
connectTcp
Deprecated.as of 5.3 in favor oftcp(String, int)
Connect to the server over TCP.- Parameters:
host
- the server hostport
- the server port- Returns:
- an
RSocketRequester
for the connection - See Also:
-
TcpClientTransport
-
connectWebSocket
Deprecated.as of 5.3 in favor ofwebsocket(URI)
Connect to the server over WebSocket.- Parameters:
uri
- the RSocket server endpoint URI- Returns:
- an
RSocketRequester
for the connection - See Also:
-
WebsocketClientTransport
-
connect
@Deprecated reactor.core.publisher.Mono<RSocketRequester> connect(io.rsocket.transport.ClientTransport transport) Deprecated.as of 5.3 in favor oftransport(ClientTransport)
Connect to the server with the givenClientTransport
.- Parameters:
transport
- the client transport to use- Returns:
- an
RSocketRequester
for the connection
-
transport(ClientTransport)