Top Description Methods
org.springframework.messaging.simp.annotation

public @Interface SendToUser

extends Annotation
Annotations
@Target:TYPE, METHOD
@Retention:RUNTIME
@Documented
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target, org.springframework.core.annotation.AliasFor

Indicates the return value of a message-handling method should be sent as a org.springframework.messaging.Message to the specified destination(s) further prepended with "/user/{username}" where the user name is extracted from the headers of the input message being handled.

Both @SendTo and @SendToUser may be used on the same method in which case a message is sent to the destinations of both annotations.

This annotation may be placed class-level in which case it is inherited by methods of the class. At the same time, method-level @SendTo or @SendToUser annotations override any such at the class level.

Authors
Rossen Stoyanchev, Sam Brannen
Since
4.0
See Also
org.springframework.messaging.simp.annotation.support.SendToMethodReturnValueHandler, org.springframework.messaging.simp.user.UserDestinationMessageHandler, org.springframework.messaging.simp.SimpMessageHeaderAccessor#getUser()

Method Summary

Modifier and TypeMethod and Description
public boolean
broadcast()

Whether messages should be sent to all sessions associated with the user or only to the session of the input message being handled.

public String[]
destinations()

One or more destinations to send a message to.

public String[]
value()

Alias for destinations.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

broadcastback to summary
public boolean broadcast()

Whether messages should be sent to all sessions associated with the user or only to the session of the input message being handled.

By default, this is set to true in which case messages are broadcast to all sessions.

destinationsback to summary
public String[] destinations()

One or more destinations to send a message to.

If left unspecified, a default destination is selected based on the destination of the input message being handled.

Annotations
@AliasFor:value
Since
4.2
See Also
value, org.springframework.messaging.simp.annotation.support.SendToMethodReturnValueHandler
valueback to summary
public String[] value()

Alias for destinations.

Annotations
@AliasFor:destinations
See Also
destinations