T - the type of the responsepublic class JmsResponse<T> extends 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,
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,
String queueName)
Create a
JmsResponse targeting the queue with the specified name. |
static <T> JmsResponse<T> |
forTopic(T result,
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. |
String |
toString() |
public T getResponse()
@Nullable 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 static <T> JmsResponse<T> forQueue(T result, String queueName)
JmsResponse targeting the queue with the specified name.public static <T> JmsResponse<T> forTopic(T result, 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.