Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

JMS : Using JMS ReplyTo queue

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Oops sorry i have posted the query in the wrong place...
i am posting it again in the J2EE section.
    Bookmark Topic Watch Topic
  • New Topic