MessageMapping(vararg value: String)
Annotation for mapping a Message onto message-handling methods by matching to the message destination. This annotation can also be used on the type-level in which case it defines a common destination prefix or pattern for all method-level annotations including method-level org.springframework.messaging.simp.annotation.SubscribeMapping annotations.
Handler methods which are annotated with this annotation are allowed to have flexible signatures. They may have arguments of the following types, in arbitrary order:
A return value will get wrapped as a message and sent to a default response destination or to a custom destination specified with an SendTo method-level annotation. Such a response may also be provided asynchronously via a org.springframework.util.concurrent.ListenableFuture return type or a corresponding JDK 8 java.util.concurrent.CompletableFuture / java.util.concurrent.CompletionStage handle.
STOMP over WebSocketAn SendTo annotation is not strictly required — by default the message will be sent to the same destination as the incoming message but with an additional prefix ("/topic" by default). It is also possible to use the org.springframework.messaging.simp.annotation.SendToUser annotation to have the message directed to a specific user if connected. The return value is converted with a org.springframework.messaging.converter.MessageConverter.
NOTE: When using controller interfaces (e.g. for AOP proxying), make sure to consistently put all your mapping annotations - such as @MessageMapping and @SubscribeMapping - on the controller interface rather than on the implementation class.
Author
Rossen Stoyanchev
Since
4.0
See Also
org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler