// there should be a JMSReplyTo so we know where to send the reply
final Destination replyTo = msg.getJMSReplyTo();
// send reply
jms.send(replyTo, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
TextMessage replyMsg = session.createTextMessage();
replyMsg.setText("My name is Arnio");
replyMsg.setJMSCorrelationID(msg.getJMSCorrelationID());
return replyMsg;
}
});
return null;
}
});
// now get started and send the first message that gets the ball rolling
JmsTemplate jms = new JmsTemplate(amq.getConfiguration().getConnectionFactory());
jms.send("hello", new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
TextMessage msg = session.createTextMessage();
msg.setText("Hello, I'm here");
return msg;
}