spring-framework / org.springframework.messaging.simp.annotation.support / SendToMethodReturnValueHandler

SendToMethodReturnValueHandler

open class SendToMethodReturnValueHandler : HandlerMethodReturnValueHandler

A 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 session id 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.

Author
Rossen Stoyanchev

Author
Sebastien Deleuze

Since
4.0

Constructors

<init>

SendToMethodReturnValueHandler(messagingTemplate: SimpMessageSendingOperations, annotationRequired: Boolean)

Functions

getDefaultDestinationPrefix

open fun getDefaultDestinationPrefix(): String

Return the configured default destination prefix.

getDefaultUserDestinationPrefix

open fun getDefaultUserDestinationPrefix(): String

Return the configured default user destination prefix.

getHeaderInitializer

open fun getHeaderInitializer(): MessageHeaderInitializer

Return the configured header initializer.

handleReturnValue

open fun handleReturnValue(returnValue: Any, returnType: MethodParameter, message: Message<*>): Unit

setDefaultDestinationPrefix

open fun setDefaultDestinationPrefix(defaultDestinationPrefix: String): Unit

Configure a default prefix to add to message destinations in cases where a method is not annotated with SendTo or does not specify any destinations through the annotation's value attribute.

By default, the prefix is set to "/topic".

setDefaultUserDestinationPrefix

open fun setDefaultUserDestinationPrefix(prefix: String): Unit

Configure a default prefix to add to message destinations in cases where a method is annotated with SendToUser but does not specify any destinations through the annotation's value attribute.

By default, the prefix is set to "/queue".

setHeaderInitializer

open fun setHeaderInitializer(headerInitializer: MessageHeaderInitializer): Unit

Configure a MessageHeaderInitializer to apply to the headers of all messages sent to the client outbound channel.

By default this property is not set.

supportsReturnType

open fun supportsReturnType(returnType: MethodParameter): Boolean

toString

open fun toString(): String