注释类型 SendToUser
@Target({METHOD,TYPE}) @Retention(RUNTIME) @Documented public @interface SendToUser
Annotation that indicates that the return value of a message-handling method should be sent as aMessage
to the specified destination(s) prepended with"/user/{username}"
where the user name is extracted from the headers of the input message being handled.The annotation may also be placed at class-level in which case all methods in the class where the annotation applies will inherit it.
- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Sam Brannen
- 另请参阅:
SendToMethodReturnValueHandler
,UserDestinationMessageHandler
,SimpMessageHeaderAccessor.getUser()
可选元素概要
可选元素 修饰符和类型 可选元素 说明 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.String[]
destinations
One or more destinations to send a message to.String[]
value
Alias fordestinations()
.
元素详细资料
value
@AliasFor("destinations") String[] value
Alias fordestinations()
.- 另请参阅:
destinations()
- 默认值:
- {}
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.
- 从以下版本开始:
- 4.2
- 另请参阅:
value()
,SendToMethodReturnValueHandler
- 默认值:
- {}
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
true
in which case messages are broadcast to all sessions.- 默认值:
- true