activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilank <ila...@hotmail.com>
Subject Re: Creating a stomp consumer clears the queue of existing messages
Date Wed, 03 Feb 2010 08:22:12 GMT

Hi!

Thanks for the quick reply!

I am indeed using Stomp Connect. However, the behavior is not consistent
with a prefetch behavior, because the messages are not available to the
consumer either. They disappear from the queue, and as long as no other
messages are sent, the consumer claims there are no messages to be had...

Is there a workaround to the prefetch issue? 
What is the default prefetch behavior in Stomp Connect?

Thanks,

Ilank


Timothy Bish wrote:
> 
> On Tue, 2010-02-02 at 07:16 -0800, ilank wrote:
>> Hi!
>> 
>> I'm using Stomp 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.
> 
> So are you using something like StompConnect to get the STOMP messages
> from the JBoss server?  If so its possible that the prefetch setting has
> no effect on this sort of connection.
> 
>> 
>> I'm using the code:
>> 
>> auto_ptr<ConnectionFactory>
>> connectionFactory(ConnectionFactory::createCMSConnectionFactory(
>> m_brokerURI) );
>> m_connection =
>> connectionFactory->createConnection(m_stompUserName,m_stompPassword);
>> m_connection->start();
>> m_session = m_connection->createSession( Session::AUTO_ACKNOWLEDGE );
>> m_destination = m_session->createQueue( "MyQueue" );
>> m_consumer = m_session->createConsumer( m_destination );
>> 
>> 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.
>> 
>> Any idea what could be wrong?
>> 
>> Thanks for your help,
>> 
>> Ilank
>> 
> 
> Regards
> Tim.
> 
> 
> -- 
> Tim Bish
> http://fusesource.com
> http://timbish.blogspot.com/
> 
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Creating-a-stomp-consumer-clears-the-queue-of-existing-messages-tp27422114p27432855.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Mime
View raw message