T - the type of the responsepublic class JmsResponse<T>
extends java.lang.Object
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.JmsListener,
SendTo| Modifier | Constructor and Description |
|---|---|
protected |
JmsResponse(T response,
java.lang.Object destination)
Create a new instance
|
| Modifier and Type | Method and Description |
|---|---|
static <T> JmsResponse<T> |
forDestination(T result,
Destination destination)
Create a
JmsResponse targeting the specified Destination. |
static <T> JmsResponse<T> |
forQueue(T result,
java.lang.String queueName)
Create a
JmsResponse targeting the queue with the specified name. |
static <T> JmsResponse<T> |
forTopic(T result,
java.lang.String topicName)
Create a
JmsResponse targeting the topic with the specified name. |
T |
getResponse()
Return the content of the response.
|
Destination |
resolveDestination(DestinationResolver destinationResolver,
Session session)
Resolve the
Destination to use for this instance. |
java.lang.String |
toString() |
protected JmsResponse(T response, java.lang.Object destination)
response - the content of the resultdestination - the destinationpublic T getResponse()
public Destination resolveDestination(DestinationResolver destinationResolver, Session session) throws JMSException
Destination to use for this instance. The DestinationResolver
and Session can be used to resolve a destination at runtime.destinationResolver - the destination resolver to use if necessarysession - the session to use, if necessaryDestination to useJMSException - if the DestinationResolver failed to resolve the destinationpublic java.lang.String toString()
toString in class java.lang.Objectpublic static <T> JmsResponse<T> forQueue(T result, java.lang.String queueName)
JmsResponse targeting the queue with the specified name.public static <T> JmsResponse<T> forTopic(T result, java.lang.String topicName)
JmsResponse targeting the topic with the specified name.public static <T> JmsResponse<T> forDestination(T result, Destination destination)
JmsResponse targeting the specified Destination.