[jboss-user] [JBoss Messaging] - Re: ListAllMessages return no messages using RMI, but no pro

hendra_netm do-not-reply at jboss.com
Fri Aug 17 07:11:02 EDT 2007


Hi Tim, 
These are my code.

However, I can't reproduce the error.
It seems my computer was tired, and couldn't access the queue :o
Yesterday and today, my code worked well. So I think the problem lies on my side not on JBM.

Thank you very much for your attention.

Best Regards,
Hendra


  |                         ic = new InitialContext();
  | 			cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
  | 			conn = cf.createConnection();
  | 			Queue queue = (Queue)ic.lookup("/queue/A");	
  | 			Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
  | 			MessageProducer prod = sess.createProducer(queue);
  | 			Message mess = sess.createObjectMessage("Test Message");
  | 			
  | 			prod.send(mess);
  | 			
  | 			MBeanServerConnection mbeanServerConnection = (MBeanServerConnection)ic.lookup("jmx/invoker/RMIAdaptor");
  | 			ObjectName objName = new ObjectName("jboss.messaging.destination:service=Queue,name=A");
  | 			List list = (List)mbeanServerConnection.invoke(objName, "listAllMessages", new Object[]{}, new String[]{});
  | 			
  | 			for(java.util.Iterator iterator=list.iterator(); iterator.hasNext();)
  | 			{
  | 				Message msgInsideQueue = (Message)iterator.next();
  | 				System.out.println("List message");
  | 			}
  | 

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

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



More information about the jboss-user mailing list