final JmsTemplate jmsTemplate = JMSFactory.createJmsTemplate(jmsConfig, null);
Thread t = new Thread() {
public void run() {
Destination destination = (Destination)jmsTemplate.execute(new SessionCallback() {
public Object 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 = (Destination)jmsTemplate.execute(new SessionCallback() {
public Object doInJms(Session session) throws JMSException {
DestinationResolver resolv = jmsTemplate.getDestinationResolver();
return resolv.resolveDestinationName(session,
jmsConfig.getReplyDestination(),
false);