Skip to content

Support expression in @SendTo for JMS endpoints [SPR-12899] #17498

@spring-projects-issues

Description

@spring-projects-issues

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:

Referenced from: commits f98a6c6

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions