Annotation Type SendToUser
@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented public @interface SendToUser
Indicates the return value of a message-handling method should be sent as aMessageto 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
@SendToand@SendToUsermay 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
@SendToor@SendToUserannotations override any such at the class level.- Since:
- 4.0
- Author:
- Rossen Stoyanchev, Sam Brannen
- See Also:
SendToMethodReturnValueHandler,UserDestinationMessageHandler,SimpMessageHeaderAccessor.getUser()
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanbroadcastWhether messages should be sent to all sessions associated with the user or only to the session of the input message being handled.String[]destinationsOne or more destinations to send a message to.String[]valueAlias fordestinations().
Element Detail
value
@AliasFor("destinations") String[] value
Alias fordestinations().- See Also:
destinations()
- Default:
- {}
destinations
@AliasFor("value") 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.
- Since:
- 4.2
- See Also:
value(),SendToMethodReturnValueHandler
- Default:
- {}
broadcast
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
truein which case messages are broadcast to all sessions.- Default:
- true