Thread t = new Thread() {
public void run() {
Destination destination = jmsTemplate.execute(new SessionCallback<Destination>() {
public Destination doInJms(Session session) throws JMSException {
DestinationResolver resolv = jmsTemplate.getDestinationResolver();
return resolv.resolveDestinationName(session, jmsConfig.getTargetDestination(),
false);
}
});
final Message message = jmsTemplate.receive(destination);
MessageCreator messageCreator = new MessageCreator() {
public Message createMessage(Session session) {
return message;
}
};
Destination destination2 = jmsTemplate
.execute(new SessionCallback<Destination>() {
public Destination doInJms(Session session) throws JMSException {
DestinationResolver resolv = jmsTemplate.getDestinationResolver();
return resolv.resolveDestinationName(session,
jmsConfig.getReplyDestination(),
false);
}
});
jmsTemplate.send(destination2, messageCreator);