org.springframework.messaging.rsocket.annotation.support

## Class RSocketPayloadReturnValueHandler

- java.lang.Object
- - org.springframework.messaging.handler.invocation.reactive.AbstractEncoderMethodReturnValueHandler
  - - org.springframework.messaging.rsocket.annotation.support.RSocketPayloadReturnValueHandler

- All Implemented Interfaces:
    HandlerMethodReturnValueHandler

      public class RSocketPayloadReturnValueHandler
      extends AbstractEncoderMethodReturnValueHandler

  Extension of `AbstractEncoderMethodReturnValueHandler` that `handles` encoded content by wrapping data buffers as RSocket payloads and by passing those through the `RESPONSE_HEADER` header.
  Since:
    5.2
  Author:
    Rossen Stoyanchev

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `RESPONSE_HEADER` Message header name that is expected to have an `AtomicReference` which will receive the `Flux<Payload>` that represents the response.

    - ### Fields inherited from class org.springframework.messaging.handler.invocation.reactive.AbstractEncoderMethodReturnValueHandler

      `logger`

    - ### Fields inherited from interface org.springframework.messaging.handler.invocation.reactive.HandlerMethodReturnValueHandler

      `DATA_BUFFER_FACTORY_HEADER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RSocketPayloadReturnValueHandler(List<Encoder<?>> encoders, ReactiveAdapterRegistry registry)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected reactor.core.publisher.Mono<Void>` | `handleEncodedContent(reactor.core.publisher.Flux<DataBuffer> encodedContent, MethodParameter returnType, Message<?> message)` Subclasses implement this method to handle encoded values in some way such as creating and sending messages.
    `protected reactor.core.publisher.Mono<Void>` | `handleNoContent(MethodParameter returnType, Message<?> message)` Invoked for a `null` return value, which could mean a void method or method returning an async type parameterized by void.

    - ### Methods inherited from class org.springframework.messaging.handler.invocation.reactive.AbstractEncoderMethodReturnValueHandler

      `getAdapterRegistry, getEncoders, handleReturnValue, supportsReturnType`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### RESPONSE_HEADER

          public static final String RESPONSE_HEADER

      Message header name that is expected to have an `AtomicReference` which will receive the `Flux<Payload>` that represents the response.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RSocketPayloadReturnValueHandler

          public RSocketPayloadReturnValueHandler(List<Encoder<?>> encoders,
                                                  ReactiveAdapterRegistry registry)

  - ### Method Detail

    - #### handleEncodedContent

          protected reactor.core.publisher.Mono<Void> handleEncodedContent(reactor.core.publisher.Flux<DataBuffer> encodedContent,
                                                                           MethodParameter returnType,
                                                                           Message<?> message)

      Description copied from class: `AbstractEncoderMethodReturnValueHandler`
      Subclasses implement this method to handle encoded values in some way such as creating and sending messages.
      Specified by:
        `handleEncodedContent` in class `AbstractEncoderMethodReturnValueHandler`
      Parameters:
        `encodedContent` - the encoded content; each `DataBuffer` represents the fully-aggregated, encoded content for one value (i.e. payload) returned from the HandlerMethod.
        `returnType` - return type of the handler method that produced the data
        `message` - the input message handled by the handler method
      Returns:
        completion `Mono<Void>` for the handling

    - #### handleNoContent

          protected reactor.core.publisher.Mono<Void> handleNoContent(MethodParameter returnType,
                                                                      Message<?> message)

      Description copied from class: `AbstractEncoderMethodReturnValueHandler`
      Invoked for a `null` return value, which could mean a void method or method returning an async type parameterized by void.
      Specified by:
        `handleNoContent` in class `AbstractEncoderMethodReturnValueHandler`
      Parameters:
        `returnType` - return type of the handler method that produced the data
        `message` - the input message handled by the handler method
      Returns:
        completion `Mono<Void>` for the handling