[Clev-jug] JMS Request/Reply problem

Shankar Mandal shankar.mandal at gmail.com
Tue Jun 20 13:19:34 CDT 2006


Hi Ryan,

Thanks for looking into the code.
There is no problem with the sample that attached.

The problem was there in the sending program.

Correlation id has to be set otherwise it will not work for request/reply
mechanism.

2 different queues is certainly is an option,  but ours is a client driven
infrastructure which we cannot modify. And there are pros and cons to that
approach.

Thanks for spending time to look into this.

Regards,
Shankar


On 6/20/06, Ryan Smith <rws at urbancode.com> wrote:
>
> 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
> >
> _______________________________________________
> Clev-jug mailing list
> Clev-jug at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/clev-jug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.urbancode.com/pipermail/clev-jug/attachments/20060620/0ca2e31a/attachment.htm


More information about the Clev-jug mailing list