Creating a stomp consumer clears the queue of existing messages
This is a re-post of the following question. I originally posted it in the ActiveMQ forum by mistake. Please accept my apologies if this bothers you.
I'm using StompConnect 1.0 and ActiveMQ C++ client 3.0.1 (Windows XP, MS dev studio 2005) to read text messages sent to JMS in JBoss.
I'm using the sample code provided in Stomp to connect and I find that if the queue contains messages, as soon as I create the consumer, they are all gone. I use JMX to look at the queue status, and whereas the counter shows the correct number of messages before the creation, it shows 0 after the creation.
Note that any massages created thereafter behave correctly.
As soon as I run the last line, the queue is empty.
I tried setting the prefetch and the pending message limit (MyQueue?consumer.prefetchSize=0&consumer.maximumPendingMessageLimit=-1) but that didn't help.
In diving into the code, I found that the queue is cleared when the outputStream is flushed with the connect command.