Skip to content

Add support of @SendTo for JMS listeners [SPR-11707] #16329

@spring-projects-issues

Description

@spring-projects-issues

Stéphane Nicoll opened SPR-11707 and commented

MessageListenerAdapter has a reply feature for quite some time: if the method to invoke has a non-void return type, the result is wrapped in a JMS Message and sent to the destination defined by the JMSReplyTO header. There is also a way to specify a default reply destination to use if that header is not set

<jms:listener-container ...>
   <jms:listener ... responseDestination="fooBar"/>
</jms:listener-container>

The new JmsListener has a responseDestination attribute with the same semantic.

This issue is about considering using @ReplyTo instead (and therefore removing the responseDestination attribute.

Several things to consider, following a brainstorming with Rossen Stoyanchev

  • Existing users trying to migrate from XML might get confused and look for that attribute. Improving the @JmsListener javadoc might help
  • The Javadoc of @SendTo should be revisited to be less imperative. Something to describe that if the incoming message defines where to send the reply, this takes precedence over the value defined by the annotation
  • Right now, getReplyChannel returns the JMSReplyTO header value for the JMS specific implementation. This shouldn't be as the use of that attribute is reserved for MessageChannel and are not applicable to simple listeners

Affects: 4.1 RC1

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