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 ofAbstractEncoderMethodReturnValueHandler
thathandles
encoded content by wrapping data buffers as RSocket payloads and by passing those to theMonoProcessor
from theRESPONSE_HEADER
header.- Since:
- 5.2
- Author:
- Rossen Stoyanchev
Field Summary
Fields Modifier and Type Field Description static String
RESPONSE_HEADER
Message header name that is expected to have aMonoProcessor
which will receive theFlux<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 Description RSocketPayloadReturnValueHandler(List<Encoder<?>> encoders, ReactiveAdapterRegistry registry)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 anull
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
Field Detail
RESPONSE_HEADER
public static final String RESPONSE_HEADER
Message header name that is expected to have aMonoProcessor
which will receive theFlux<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 classAbstractEncoderMethodReturnValueHandler
- Parameters:
encodedContent
- the encoded content; eachDataBuffer
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 datamessage
- 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 anull
return value, which could mean a void method or method returning an async type parameterized by void.- Specified by:
handleNoContent
in classAbstractEncoderMethodReturnValueHandler
- Parameters:
returnType
- return type of the handler method that produced the datamessage
- the input message handled by the handler method- Returns:
- completion
Mono<Void>
for the handling