activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter anderson <peter.ander...@egsgroup.com>
Subject receiveNoWait problem
Date Fri, 18 Aug 2006 08:04:40 GMT
Hi,

I am evaluating ActiveMQ against Joram as my companies JMS provider.

I am using a producer servlet to produce a 1000 object messages and using a
consuming servlet to consume the messages (SEE CODE BELOW).

The problem is the messages are NOT being found. If I run it through debugger in 
Eclipse it works as expected. This suggests it is a timing issue. Is this
correct and if so how may milliseconds should be used with the receive() 
method ?

p.s. it works fine in Joram.

TIA Peter


/*
 * Consume messages until no more are found.
 */		    
		    ObjectMessage message ;
		    
		    while ( true )
		    {
		    	Message m = consumer.receiveNoWait() ;
		    	
		    	if ( m instanceof ObjectMessage )
		    	{
		    		message = (ObjectMessage) m ;
		    		
		    		out.println( "Reading message: " + ( (InvBean) message.getObject()
).toString() + "<br />" ) ;
		    	}
		    	else if ( m instanceof TextMessage )
		    	{
		    		out.println( "Reading TEXT message: " + ( (TextMessage) m ).getText() +
"<br />" ) ;
		    	}
		    	else
		    	{
		    		break ;
		    	}
		    }
		}




Mime
View raw message