-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
John W opened SPR-12899 and commented
I have a case where a JMSListener needs to send back a message on the original queue/topic it was received.
Here is a really small version of what I am trying to do:
foo.topic=my.foo.topic
@Component
public class FooReceiver {
...
@JmsListener(destination = "${foo.topic}")
@SendTo("${foo.topic}")
public Message<String> handleFooMessage(final String message) {
...
Message<String> reply = MessageBuilder.withPayload(someString).build();
return reply;
}
The replies were never showing up.
I set a JMSReplyTo on the incoming message, and then the reply worked. Strange..
So I started stepping through org.springframework.jms.config.MethodJmsListenerEndpoint.getDefaultResponseDestination() to make sure that I wasn't having some sort of proxy issue (i.e. #17118). On line 122 though, I could see the issue - the value of
return (String) destinations[0];
shows up as
[${foo.topic}]
In other words, it does not appear to be getting expanded. Sure enough, in my activemq queue list I see a queue named ${foo.topic}.
Should I expect this property to be getting expanded inside the @SendTo
annotation?
Thanks
John
Affects: 4.1.4
Issue Links:
- Support destination variable placeholders in @SendTo and @SendToUser for STOMP endpoints [SPR-12170] #16784 Support destination variable placeholders in
@SendTo
and@SendToUser
for STOMP endpoints
Referenced from: commits f98a6c6