File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes JMS : Using JMS ReplyTo queue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

JMS : Using JMS ReplyTo queue

Anand Sidharth
Ranch Hand

Joined: Dec 17, 2003
Posts: 44
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 -
Anand Sidharth
Ranch Hand

Joined: Dec 17, 2003
Posts: 44
Oops sorry i have posted the query in the wrong place...
i am posting it again in the J2EE section.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JMS : Using JMS ReplyTo queue