public class SubscriptionMethodReturnValueHandler extends java.lang.Object implements HandlerMethodReturnValueHandler
HandlerMethodReturnValueHandler for replying directly to a subscription. It
supports methods annotated with SubscribeMapping unless they're also annotated
with SendTo or SendToUser.
The value returned from the method is converted, and turned to a Message and
then enriched with the sessionId, subscriptionId, and destination of the input message.
The message is then sent directly back to the connected client.
| Constructor and Description |
|---|
SubscriptionMethodReturnValueHandler(MessageSendingOperations<java.lang.String> messagingTemplate) |
| Modifier and Type | Method and Description |
|---|---|
void |
handleReturnValue(java.lang.Object returnValue,
org.springframework.core.MethodParameter returnType,
Message<?> message)
Handle the given return value.
|
boolean |
supportsReturnType(org.springframework.core.MethodParameter returnType)
Whether the given method return type is
supported by this handler.
|
public SubscriptionMethodReturnValueHandler(MessageSendingOperations<java.lang.String> messagingTemplate)
messagingTemplate - a messaging template for sending messages directly
to clients, e.g. in response to a subscriptionpublic boolean supportsReturnType(org.springframework.core.MethodParameter returnType)
HandlerMethodReturnValueHandlersupportsReturnType in interface HandlerMethodReturnValueHandlerreturnType - the method return type to checktrue if this handler supports the supplied return type;
false otherwisepublic void handleReturnValue(java.lang.Object returnValue,
org.springframework.core.MethodParameter returnType,
Message<?> message)
throws java.lang.Exception
HandlerMethodReturnValueHandlerhandleReturnValue in interface HandlerMethodReturnValueHandlerreturnValue - 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 truemessage - the message that caused this method to be calledjava.lang.Exception - if the return value handling results in an error