This discussion is archived
2 Replies Latest reply: Jun 5, 2013 11:01 AM by Stuart Fleming RSS

JMS produce to Queue and Response to where?

Stuart Fleming Explorer
Currently Being Moderated
Hello,
My question concerns the proper way to configure a java program that reads a queue and then generates a response -- where does it send it back to? The same Queue? a different queue?

I am following along the SOA 11g Handbook: Source code here: http://technology.amis.nl/2010/09/21/soa-suite-11g-handbook-chapter-complements/

If you look at chapter 12, the TheFinancialApplication it gives an example of a java program that produces a message and sends it to a queue that is is set up in weblogic.

There is a second program that reads the message from the queue, and then it produces a response, adds the corelationID and sends it back TO THE SAME QUEUE.

IS THIS CORRECT??? Should it go to a different queue, like a Response queue?

When I created a response queue and sent it "back" to that, it worked and nicely. But the example included in the 11g handbook had it going to the same queue, so one would think that was correct.....

I am not asking you to open up the application, you can if you want, but in general, I am wondering if responses should go back to the same queue.

With the response program both listening to and responding to the same queue, the program seems to be tripping over itself -- The program that reads the queue creates a response, sends it back to the queue, then reads that same response, responds to that response, sends it, reads it, responds....just goes on in an endless loop. It also writes back some of what it just read, so the text just grows and grows....

Thank you very much for your time! Helpful replies will be promptly awarded!

Stuart

Here is what it is producing, if you are curious.....

<?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: <?xml version="1.0" ?><NewPatientAdvise xmlns="http://com.stmatthews.hospital/finance/FinanceQueueTwoWayInformer"><PatientName>Return: Stu</PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName><Advise>this patient poses no special financial risks</Advise></NewPatientAdvise></PatientName>

Edited by: Stuart Fleming on Jun 5, 2013 9:25 AM added a clarification...
  • 1. Re: JMS produce to Queue and Response to where?
    r035198x Pro
    Currently Being Moderated
    It's you who decides where to post the message based on your requirements.
    It's not common to post back to the same queue but it there are scenarios where it can be used. If the onMessage logic updates the message then it is possible that it will be treated differently on next pass so it doesn't always result in infinitely posting back the same message.
  • 2. Re: JMS produce to Queue and Response to where?
    Stuart Fleming Explorer
    Currently Being Moderated
    I re-wrote the code with a header and then wrote code in the consumer to not produce a response message if it was reading its own message.

    However, the message produced by the consuming program was immediately read by the consuming program, and disappeared from the queue -- so it the original program that sent the message might not get it -- not good.

    Thanks, it didn't seem like it should go to the same queue, but I wasn't sure.

    Stuart

    Edited by: Stuart Fleming on Jun 5, 2013 11:00 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points