org.springframework.messaging.rsocket

## Interface RSocketRequester.Builder

- Enclosing interface:
    RSocketRequester

      public static interface RSocketRequester.Builder

  Builder to create a requester by connecting to a server.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `RSocketRequester.Builder` | `apply(Consumer<RSocketRequester.Builder> configurer)` Configure this builder through a `Consumer`.
    `reactor.core.publisher.Mono<RSocketRequester>` | `connect(ClientTransport transport)` Deprecated. as of 5.3 in favor of `transport(ClientTransport)`
    `reactor.core.publisher.Mono<RSocketRequester>` | `connectTcp(String host, int port)` Deprecated. as of 5.3 in favor of `tcp(String, int)`
    `reactor.core.publisher.Mono<RSocketRequester>` | `connectWebSocket(URI uri)` Deprecated. as of 5.3 in favor of `websocket(URI)`
    `RSocketRequester.Builder` | `dataMimeType(MimeType mimeType)` Configure the payload data MimeType to specify on the `SETUP` frame that applies to the whole connection.
    `RSocketRequester.Builder` | `metadataMimeType(MimeType mimeType)` Configure the payload metadata MimeType to specify on the `SETUP` frame that applies to the whole connection.
    `RSocketRequester.Builder` | `rsocketConnector(RSocketConnectorConfigurer configurer)` Callback to configure the `RSocketConnector` directly.
    `RSocketRequester.Builder` | `rsocketStrategies(Consumer<RSocketStrategies.Builder> configurer)` Customize the `RSocketStrategies`.
    `RSocketRequester.Builder` | `rsocketStrategies(RSocketStrategies strategies)` Provide the `RSocketStrategies` 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.
    `RSocketRequester` | `tcp(String host, int port)` Build an `RSocketRequester` with an `RSocketClient` that connects over TCP to the given host and port.
    `RSocketRequester` | `transport(ClientTransport transport)` Variant of `tcp(String, int)` and `websocket(URI)` with an already initialized `ClientTransport`.
    `RSocketRequester` | `transports(Publisher<List<LoadbalanceTarget>> targetPublisher, LoadbalanceStrategy loadbalanceStrategy)` Build an `RSocketRequester` with an `LoadbalanceRSocketClient` that will connect to one of the given targets selected through the given `LoadbalanceRSocketClient`.
    `RSocketRequester` | `websocket(URI uri)` Build an `RSocketRequester` with an `RSocketClient` that connects over WebSocket to the given URL.

- - ### Method Detail

    - #### dataMimeType

          RSocketRequester.Builder dataMimeType(@Nullable
                                                MimeType mimeType)

      Configure the payload data MimeType to specify on the `SETUP` 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 the `SETUP` 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 configured `dataMimeType(MimeType)`. The data be a concrete value or any producer of a single value that can be adapted to a `Publisher` via `ReactiveAdapterRegistry`.

      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 in `RSocketRequester.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 to `setupRoute(String, Object...)`. The metadata value be a concrete value or any producer of a single value that can be adapted to a `Publisher` via `ReactiveAdapterRegistry`.

    - #### rsocketStrategies

          RSocketRequester.Builder rsocketStrategies(@Nullable
                                                     RSocketStrategies strategies)

      Provide the `RSocketStrategies` to use.

      This is useful for changing the default settings, yet still allowing further customizations via `rsocketStrategies(Consumer)`. If not set, defaults are obtained from `RSocketStrategies.builder()`.

      Parameters:
        `strategies` - the strategies to use

    - #### rsocketStrategies

          RSocketRequester.Builder rsocketStrategies(Consumer<RSocketStrategies.Builder> configurer)

      Customize the `RSocketStrategies`.

      Allows further customization on `RSocketStrategies`, mutating them if they were `set`, or starting from `RSocketStrategies.builder()` defaults}.

    - #### rsocketConnector

          RSocketRequester.Builder rsocketConnector(RSocketConnectorConfigurer configurer)

      Callback to configure the `RSocketConnector` directly.
      - The data and metadata mime types cannot be set directly on the `RSocketConnector` and will be overridden. Use the shortcuts `dataMimeType(MimeType)` and `metadataMimeType(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

    - #### apply

          RSocketRequester.Builder apply(Consumer<RSocketRequester.Builder> configurer)

      Configure this builder through a `Consumer`. This enables libraries such as Spring Security to provide shortcuts for applying a set of related customizations.
      Parameters:
        `configurer` - the configurer to apply

    - #### tcp

          RSocketRequester tcp(String host,
                               int port)

      Build an `RSocketRequester` with an `RSocketClient` 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 to
        `port` - the port to connect to
      Returns:
        the created `RSocketRequester`
      Since:
        5.3

    - #### websocket

          RSocketRequester websocket(URI uri)

      Build an `RSocketRequester` with an `RSocketClient` 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

          RSocketRequester transport(ClientTransport transport)

      Variant of `tcp(String, int)` and `websocket(URI)` with an already initialized `ClientTransport`.
      Parameters:
        `transport` - the transport to connect with
      Returns:
        the created `RSocketRequester`
      Since:
        5.3

    - #### transports

          RSocketRequester transports(Publisher<List<LoadbalanceTarget>> targetPublisher,
                                      LoadbalanceStrategy loadbalanceStrategy)

      Build an `RSocketRequester` with an `LoadbalanceRSocketClient` that will connect to one of the given targets selected through the given `LoadbalanceRSocketClient`.
      Parameters:
        `targetPublisher` - a `Publisher` that supplies a list of target transports to loadbalance against; the given list may be periodically updated by the `Publisher`.
        `loadbalanceStrategy` - the strategy to use for selecting from the list of loadbalance targets.
      Returns:
        the created `RSocketRequester`
      Since:
        5.3

    - #### connectTcp

          @Deprecated
          reactor.core.publisher.Mono<RSocketRequester> connectTcp(String host,
                                                                               int port)

      Deprecated. as of 5.3 in favor of `tcp(String, int)`
      Connect to the server over TCP.
      Parameters:
        `host` - the server host
        `port` - the server port
      Returns:
        an `RSocketRequester` for the connection
      See Also:
        `TcpClientTransport`

    - #### connectWebSocket

          @Deprecated
          reactor.core.publisher.Mono<RSocketRequester> connectWebSocket(URI uri)

      Deprecated. as of 5.3 in favor of `websocket(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(ClientTransport transport)

      Deprecated. as of 5.3 in favor of `transport(ClientTransport)`
      Connect to the server with the given `ClientTransport`.
      Parameters:
        `transport` - the client transport to use
      Returns:
        an `RSocketRequester` for the connection