public class SendToMethodReturnValueHandler extends Object implements HandlerMethodReturnValueHandler
HandlerMethodReturnValueHandler
for sending to destinations specified in a
SendTo
or SendToUser
method-level annotations.
The value returned from the method is converted, and turned to a Message
and
sent through the provided MessageChannel
. The
message is then enriched with the sessionId of the input message as well as the
destination from the annotation(s). If multiple destinations are specified, a copy of
the message is sent to each destination.
Constructor and Description |
---|
SendToMethodReturnValueHandler(SimpMessageSendingOperations messagingTemplate,
boolean annotationRequired) |
Modifier and Type | Method and Description |
---|---|
void |
handleReturnValue(Object returnValue,
MethodParameter returnType,
Message<?> inputMessage)
Handle the given return value.
|
boolean |
supportsReturnType(MethodParameter returnType)
Whether the given method return type is
supported by this handler.
|
String |
toString() |
public SendToMethodReturnValueHandler(SimpMessageSendingOperations messagingTemplate, boolean annotationRequired)
public boolean supportsReturnType(MethodParameter returnType)
HandlerMethodReturnValueHandler
supportsReturnType
in interface HandlerMethodReturnValueHandler
returnType
- the method return type to checktrue
if this handler supports the supplied return type;
false
otherwisepublic void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> inputMessage) throws Exception
HandlerMethodReturnValueHandler
handleReturnValue
in interface HandlerMethodReturnValueHandler
returnValue
- the value returned from the handler methodreturnType
- the type of the return value. This type must have
previously been passed to
HandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter)
and it must have returned true
inputMessage
- the message that caused this method to be calledException
- if the return value handling results in an error