[Clev-jug] JMS Request/Reply problem
Ryan Smith
rws at urbancode.com
Tue Jun 20 12:51:08 CDT 2006
Hi Shankar,
I haven't used the JMS Correlation ID before. Have you tried it without
setting that?
//response.setJMSCorrelationID(msg.getJMSMessageID());
Using the request message's JMS ID as the correlation ID might be
causing the JMS provider to be doing something specific with it.
Just to get the obvious out of the way too, you have two different
queues for this right? One for the request side and one for the response
side.
Ryan Smith
Shankar Mandal wrote:
> Hi,
>
> I am using Request/REply mechanism using JMS.
>
> My Reply is using the following code to send back the response to the
> requesting program.
>
> ===============================================
>
> public void onMessage(Message msg)
> {
> try {
> String msgText;
> if (msg instanceof TextMessage) {
> msgText = ((TextMessage)msg).getText();
> } else {
> msgText = msg.toString ();
> }
> int value = Integer.parseInt(msgText);
> Queue responseQ = (Queue)msg.getJMSReplyTo();
> System.out.println("Temporary Queue="+responseQ.getQueueName());
> responseSender = qsession.createSender (responseQ);
>
> Message response =
> qsession.createTextMessage(String.valueOf(value*value));
> System.out.println("Received Message with ID:"+msg.getJMSMessageID()
> +" and value:"+msgText);
> response.setJMSCorrelationID(msg.getJMSMessageID());
>
> responseSender.send(response);
>
> if (msgText.equalsIgnoreCase("quit")) {
> synchronized(this) {
> quit = true;
> this.notifyAll(); // Notify main thread to quit
> }
> }
> } catch (JMSException jmse) {
> jmse.printStackTrace();
> }
> }
>
> ============================================
>
> But the request code is not able to get the response back. Can anyone
> look in the aboce code and let me know if there is any problem.
>
> Thanks,
>
> Shankar
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Clev-jug mailing list
> Clev-jug at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/clev-jug
>
More information about the Clev-jug
mailing list