Skip to content

Conversation

@salmar
Copy link

@salmar salmar commented Sep 15, 2014

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

@MessageMapping("/dest")
public ResponseMessage<String> handle() {
        return ResponseMessage.destination("/queue/dest1").toUser("sergi").body("hi");
}

Other examples:

new ResponseMessage<String>("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);

Issue: SPR-12170

@salmar
Copy link
Author

salmar commented Sep 15, 2014

I have signed and agree to the terms of the SpringSource Individual
Contributor License Agreement.

@pivotal-issuemaster
Copy link

@salmar Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@rstoyanchev rstoyanchev added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Nov 11, 2021
@rstoyanchev
Copy link
Contributor

Closing outdated, as per discussion under #16784.

@rstoyanchev rstoyanchev removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: web Issues in web modules (web, webmvc, webflux, websocket)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants