Skip to content

Allow body of JmsListener annotated method to define returned Message Destination [SPR-13133] #17724

@spring-projects-issues

Description

@spring-projects-issues

Bart Prokop opened SPR-13133 and commented

There are three possible use-cases for JmsListener annotated method processing:

  1. request-reply scenario. The request have a JMSReplyTo set. Supported.
  2. processing messages and sending result back to predefined queue. Supported with SendTo annotation.
  3. processing message but the destination where to send response is determined during request processing. In most trivial case it can be forwarding incoming message to various destination, based on incoming message evaluation. There is no elegant solution to do this.

Please note that elegant solution would allow for implementing very rich/advance functionality inside listeners including dispatching multiple replies, dynamic destinations.

Some workaround for point 3 exists like returning void and use JMSTemplate or hacking request JMSReplyTo - but they are not elegant solution and not intended to use patterns.

The solution would require to inspect returning object that could be placeholder for both Message and Destination. There was some discussion around it that excluded using Message properties for this as JMS non compliant solution (see the ref URL). Alternatively a Map<Message, Destination> could be passed as parameter (or returned from listener method).


Reference URL: #817

Referenced from: commits be43295, bd093eb, c8fcdad

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