I am setting the replyTo queue in the message i send to a queue in the following way:
QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup("TESTQMQCF");
QueueConnection connection = qcf.createQueueConnection();
Queue queue = (Queue)ctx.lookup("TESTQMQ");//remote queue
Queue replyqueue = (Queue)ctx.lookup("TESTQMQREPLY");//local queue
QueueSession session = connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(queue);
TextMessage outMessage = session.createTextMessage();
outMessage.setText(line);
outMessage.setJMSCorrelationID("ANAND");
outMessage.setJMSReplyTo(replyqueue);
sender.send(outMessage);
In the receiving end, a java program receives the message and gets the
JMSreplyTo queue.
QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup("TESTQM100QCF");
QueueConnection connection = qcf.createQueueConnection();
Queue queue = (Queue)ctx.lookup("TESTQM100Q");//Local queue
QueueSession session = connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
QueueReceiver receiver = session.createReceiver(queue);
connection.start();
outMessage = (TextMessage)receiver.receive(10000);
line = outMessage.getText();
Queue replyTo = (Queue) outMessage.getJMSDestination();
I want to post a message to this replyTo queue from the receiver side program. How can i put a message to this replyto queue?
Please suggest me a way
-