Class JmsResponse<T>

  • Type Parameters:
    T - the type of the response

    public class JmsResponse<T>
    extends Object
    Return type of any JMS listener method used to indicate the actual response destination alongside the response itself. Typically used when said destination needs to be computed at runtime.

    The example below sends a response with the content of the result argument to the queueOut Queue:

     package com.acme.foo;
    
     public class MyService {
         @JmsListener
         public JmsResponse process(String msg) {
             // process incoming message
             return JmsResponse.forQueue(result, "queueOut");
         }
     }
    If the destination does not need to be computed at runtime, @SendTo is the recommended declarative approach.
    Since:
    4.2
    Author:
    Stephane Nicoll
    See Also:
    JmsListener, SendTo