The code is very similar to that given by activemq: http://activemq.apache.org/how-should-i-implement-request-response-with-jms.html
The only thing different in my code is that I use: replyConsumer.receive(10000) to receive the reply instead of implementing MessageListener on producer side. On the consumer ( Server) I implement MessageListener just like given by activemq link above. I looked at Java docs for MessageListener: http://docs.oracle.com/javaee/1.3/api/javax/jms/MessageListener.html it says: "Each session must insure that it passes messages serially to the listener. This means that a listener assigned to one or more consumers of the same session can assume that the onMessage method is not called with the next message until the session has completed the last call." So how can I tell activemq to send next message to the same queue after the current message reply has been received from that queue? In my situation, thousands of message are sent to the same queue an hour. Most message response comes back quickly but a few messages are those types which can take several seconds to get response back. After digging deeply into massive logs I discovered that a message foo's reply was of unexpected type ActiveMQObjectMessage but foo's actual response showed up in bar's message. So something really is messed up. On Thu, Sep 26, 2013 at 9:35 PM, javaG <zenmatix@> wrote: > I have a consumer client and producer client. Producer client sends > message > to producer client via a queue and using request/reply message pattern. So > producer is blocked until a reply comes back from consumer. Most of the > times it works fine and I get javax.jms.TextMessage type message but > occasionaly and quite unexpectedly I get an instance of > ActiveMQObjectMessage. I could not track the source of this problem. Hope > someone can post a reply to solve this problem. I am using 5.8 activemq. > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/Getting-ActiveMQObjectMessage-instead-of-TextMessage-tp4671877.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > -- *Christian Posta* http://www.christianposta.com/blog twitter: @christianposta -- View this message in context: http://activemq.2283324.n4.nabble.com/Getting-ActiveMQObjectMessage-instead-of-TextMessage-tp4671877p4671928.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.