注释类型 SendToUser


  • @Target({TYPE,METHOD})
    @Retention(RUNTIME)
    @Documented
    public @interface SendToUser
    Indicates the return value of a message-handling method should be sent as a 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.

    从以下版本开始:
    4.0
    作者:
    Rossen Stoyanchev, Sam Brannen
    另请参阅:
    SendToMethodReturnValueHandler, UserDestinationMessageHandler, SimpMessageHeaderAccessor.getUser()
    • 可选元素概要

      可选元素 
      修饰符和类型可选元素说明
      booleanbroadcast
      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 for destinations().
      • 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