Class RSocketPayloadReturnValueHandler
java.lang.Object
org.springframework.messaging.handler.invocation.reactive.AbstractEncoderMethodReturnValueHandler
org.springframework.messaging.rsocket.annotation.support.RSocketPayloadReturnValueHandler
- All Implemented Interfaces:
HandlerMethodReturnValueHandler
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
FieldsModifier and TypeFieldDescriptionstatic final String
Message header name that is expected to have anAtomicReference
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
ConstructorsConstructorDescriptionRSocketPayloadReturnValueHandler
(List<Encoder<?>> encoders, ReactiveAdapterRegistry registry) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 Details
-
RESPONSE_HEADER
Message header name that is expected to have anAtomicReference
which will receive theFlux<Payload>
that represents the response.- See Also:
-
-
Constructor Details
-
RSocketPayloadReturnValueHandler
public RSocketPayloadReturnValueHandler(List<Encoder<?>> encoders, ReactiveAdapterRegistry registry)
-
-
Method Details
-
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
-