This content has been marked as final.
Show 2 replies
-
1. Re: ListAllMessages return no messages using RMI, but no pro
timfox Aug 16, 2007 2:56 AM (in response to hendra_netm)Can you post a failing code example?
-
2. Re: ListAllMessages return no messages using RMI, but no pro
hendra_netm Aug 17, 2007 7:11 AM (in response to hendra_netm)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,
Hendraic = 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"); }