[jboss-user] [JBoss Messaging] - Re: Messages Stuck in Queue

guinsu do-not-reply at jboss.com
Wed Oct 18 09:42:42 EDT 2006


Ok, I've been running various tests and it seems that once items get stuck in the jboss queue the only way to fix it is to stop and restart the queue.  
When items got stuck, I shut down all my producers and consumers and ran the following program, it never received a single item from the queue. I have also switch my back end database from the default HSQL to MySQL, JBoss behaved the same way with both DBs.  Also, I have noticed the queue size on the stuck queue would be wildly innaccurate at various times.  From these problems and the fact that this simple program receives nothing the problem appears to be in JBoss.


  | import javax.jms.*;
  | 
  | import java.util.concurrent.atomic.AtomicBoolean;
  | import javax.naming.Context;
  | import javax.naming.InitialContext;
  | import org.apache.log4j.Logger;
  | import org.apache.log4j.PropertyConfigurator;
  | 
  | public class JMSDrainTest
  | {
  | 	private static final Logger log = Logger.getLogger(JMSDrainTest.class.getName());
  | 
  | 	/**
  | 	 * Starts up many send and recieve threads.
  | 	 *
  | 	 * @param    args                a  String[]
  | 	 *
  | 	 */
  | 	public static void main(String[] args)
  | 	{
  | 		System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
  | 		System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
  | 
  | 		String log_file=args[0];
  | 		try
  | 		{
  | 			PropertyConfigurator.configure(JMSLargeFileTest.class.getResource("/"+log_file));
  | 			AtomicBoolean done = new AtomicBoolean(false);
  | 			String clientID = "IndexDrainer-"+System.currentTimeMillis();
  | 			Connection connection;
  | 			Context ic;
  | 			ic = new InitialContext();
  | 			log.info("Looking up ConnectionFactory");
  | 			ConnectionFactory connectionFactory = (ConnectionFactory) ic.lookup("/ConnectionFactory");
  | 			clientID = clientID.replaceAll("\\.", "-");
  | 
  | 			log.info("Creating connection");
  | 			connection = connectionFactory.createConnection();
  | 			connection.setClientID(clientID);
  | 			log.info("Starting connection");
  | 			connection.start();
  | 
  | 			String name="/queue/Index";
  | 			log.info("Creating session");
  | 			Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
  | 			log.info("Looking up destination");
  | 			Destination destination = (Destination)ic.lookup(name);
  | 			log.info("Creating consumer");
  | 			MessageConsumer consumer = session.createConsumer(destination, null, false);
  | 
  | 			log.info("Start Receive");
  | 			while(!done.get())
  | 			{
  | 				consumer.receive();
  | 				log.info("Receiving");
  | 			}
  | 		}
  | 		catch (JMSException e)
  | 		{
  | 			log.error(e.toString(), e);
  | 		}
  | 		catch (Exception e)
  | 		{
  | 			log.error(e.toString(), e);
  | 		}
  | 		catch (Error e)
  | 		{
  | 			log.error(e.toString(), e);
  | 		}
  | 
  | 	}
  | }
  | 
  | 

Output:

18 Oct 2006 09:38:03 INFO : Looking up ConnectionFactory
18 Oct 2006 09:38:04 INFO : Creating connection
18 Oct 2006 09:38:05 INFO : Starting connection
18 Oct 2006 09:38:05 INFO : Creating session
18 Oct 2006 09:38:06 INFO : Looking up destination
18 Oct 2006 09:38:06 INFO : Creating consumer
18 Oct 2006 09:38:06 INFO : Start Receive

Then it just sits.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979080#3979080

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979080



More information about the jboss-user mailing list