activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcorgan <>
Subject All messages in queue repeatedly vanish, but reappear after restart
Date Fri, 11 Jul 2008 15:26:59 GMT

I have been publishing 100,000 simple messages into a queue, and then having
~5 consumers pull them off the queue as fast as possible.  I haven't been
able to figure out exactly what triggers it, but usually the all the
messages in the queue will disappear.  The web console indicates that they
are in the "pending" state, but if I click the queue name in the web
console, there are no messages.  Restarting ActiveMQ brings back the
messages, but the pending message count is zero.  As the recovered messages
are consumed, the pending message count goes negative.

Does anyone know why these messages vanish?  There can be like 80,000 of
them disappear all at once.

I've noticed the problem occurs more frequently if I lower the receive
timeout, increase the number of consumers, or start/close a new session for
each message.  So, it's basically failing under load.

I'm basically trying to do round-robin distribution of document ids to job
processing servers.  It's for real estate listings on  I
can't find anyone else with exactly this same problem, but it's occuring so
frequently that I must be doing something abnormal.  See anything strange in
my consumer code below?


public class MessagingTest{	

	public static void main(String[] args)throws Exception{

	public static final String TEST_PORT = "tcp://";
	public static final String TEST_QUEUE = "test";

	public static void testConsumeSomeMessages() throws Exception {
		ConnectionFactory connectionFactory = new
		if (connectionFactory instanceof ActiveMQConnectionFactory) {
			ActiveMQPrefetchPolicy po = new ActiveMQPrefetchPolicy();
			((ActiveMQConnectionFactory) connectionFactory).setPrefetchPolicy(po);
		Connection connection = connectionFactory.createConnection();
		Session session = connection.createSession(false,
		Destination destination = session.createQueue(TEST_QUEUE);
		MessageConsumer consumer = session.createConsumer(destination);
		TextMessage message = null;
		while (true) {
			message = (TextMessage) consumer.receive(5000);
			if (message == null){ break; }

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message