spring-projects/spring-framework — pull request #645 by salmar (2014-09-15 08:57:35+00:00)
Title: Added support for ResponseMessage response type in @Controller message handling methods

Prior to this commit, the only way to override the destination to send the response of message handling methods was by using _@SendTo_ or _@SendToUser_, which doesn't allow building dynamic destinations.

The added _ResponseMessage_ return type brings more flexibility when specifying the response message, which can be created using a builder, e.g
```java
@MessageMapping("/dest")
public ResponseMessage handle() {
return ResponseMessage.destination("/queue/dest1").toUser("sergi").body("hi");
}
```
Other examples:
```java
new ResponseMessage("hi there", "/topic/dest1");
ResponseMessage.destination("/topic/dest1").body(PAYLOAD);
ResponseMessage.destinations("/queue/dest1", "/queue/dest2").toUser(USERNAME).body(PAYLOAD);
ResponseMessage.destination("/queue/dest1").toCurrentUser().body(PAYLOAD);
ResponseMessage.destination("/queue/dest1").toCurrentUserNoBroadcast().body(PAYLOAD);
```