Class SubscriptionMethodReturnValueHandler

java.lang.Object
org.springframework.messaging.simp.annotation.support.SubscriptionMethodReturnValueHandler
All Implemented Interfaces:
HandlerMethodReturnValueHandler

public class SubscriptionMethodReturnValueHandler extends Object implements HandlerMethodReturnValueHandler
HandlerMethodReturnValueHandler for replying directly to a subscription. It is supported on methods annotated with SubscribeMapping such that the return value is treated as a response to be sent directly back on the session. This allows a client to implement a request-response pattern and use it for example to obtain some data upon initialization.

The value returned from the method is converted and turned into a Message that is then enriched with the sessionId, subscriptionId, and destination of the input message.

Note: this default behavior for interpreting the return value from an @SubscribeMapping method can be overridden through use of the SendTo or SendToUser annotations in which case a message is prepared and sent to the broker instead.

Since:
4.0
Author:
Rossen Stoyanchev, Sebastien Deleuze