Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support destination variable placeholders in @SendTo and @SendToUser for STOMP endpoints [SPR-12170] #16784

Closed
spring-issuemaster opened this issue Sep 9, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Sep 9, 2014

Sergi Almar opened SPR-12170 and commented

Default destination to send return values of message handler methods can be overridden using either @SendTo or @SendToUser, but destination needs to be statically specified. It would be useful to pass variables or at least expose @MessageMapping destination placeholders. Here's an example:

@MessageMapping("/chat.message.{roomName}")
@SendTo("/topic/chat.message.filtered.{roomName}")
public ChatMessage filterMessage(@Payload ChatMessage message) {
...		
}

Affects: 4.1 GA

Issue Links:

  • #17498 Support expression in @SendTo for JMS endpoints

Referenced from: pull request #645, and commits 16ee692

1 votes, 10 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 3, 2014

Stéphane Nicoll commented

There are actually similar use cases in JMS/AMQP where the handling of the reply is currently hardcoded and would benefit from such extension as well. I had a look to the PR and this looks promising but I'd argue we need more thinking on how to design that with respect to the other implementations.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 17, 2015

Rossen Stoyanchev commented

Since we now have support for expressions on the JMS side, it makes sense to do that on the STOMP side as well and perhaps that's all there is to do for this request.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 22, 2015

Rossen Stoyanchev commented

Actually the placeholders mentioned in the original description at the top are "destination" placeholders, i.e. specific to the current message. Support for Environment placeholders as was added on the JMS side with commit f98a6c has valid use cases too, like making part of the destination configurable through a property, but it's not what's requested here.

I think we can add support for "destination" variable placeholders as part of this ticket. Seems like a nice feature.

Beyond that, in terms of a dedicated return value type alternative, analogous to ResponseEntity in addition to @ResponseBody, it would essentially result in a call to one of the SimpMessagingTemplate methods which we already expect and encourage to use within a controller. So I think we can hold off on adding a return type for now.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 22, 2015

Rossen Stoyanchev commented

I've added support for destination variable placeholders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.