Management Queue Attributes?
unsavory Jul 2, 2010 3:13 PMIs there anywhere we can get a list of the valid management queue attributes? It seems these should be constants somewhere, but I can't for the life of me find them.
Also, it is possible to get the message counters via the management queue in the same way you retrieve them via JMX? The documentation would suggest that you can.
Here is the code I am using:
Queue managementQueue = new HornetQQueue("hornetq.management"); QueueSession session = (QueueSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE); QueueRequestor requestor = new QueueRequestor(session, managementQueue); Message m = session.createMessage(); //JMSManagementHelper.putAttribute(m, "jms.queue.myQueue", "MessageCount"); JMSManagementHelper.putAttribute(m, "jms.queue.myQueue", "ListMessageCounter"); Message reply = requestor.request(m); //int messageCount = (Integer) JMSManagementHelper.getResult(reply); String counters = (String) JMSManagementHelper.getResult(reply); //System.out.println("jms.queue.toolbarEventQueue contains " + messageCount + " messages"); MessageCounterInfo counter = MessageCounterInfo.fromJSON(counters); System.out.format("%s (sample updated at %s)\n", counter.getName(), counter.getUdpateTimestamp()); System.out.format(" %s message(s) added to the queue (since last sample: %s)\n", counter.getCount(), counter.getCountDelta()); System.out.format(" %s message(s) in the queue (since last sample: %s)\n", counter.getDepth(), counter.getDepthDelta()); System.out.format(" last message added at %s\n\n", counter.getLastAddTimestamp());
And I get the following error message:
WARNING: exception while retrieving attribute ListMessageCounter on jms.queue.toolbarEventQueue
java.lang.IllegalStateException: Problem while retrieving attribute ListMessageCounter
at org.hornetq.core.server.management.impl.ManagementServiceImpl.getAttribute(ManagementServiceImpl.java:767)
at org.hornetq.core.server.management.impl.ManagementServiceImpl.handleMessage(ManagementServiceImpl.java:462)
at org.hornetq.core.server.impl.ServerSessionImpl.handleManagementMessage(ServerSessionImpl.java:1112)
at org.hornetq.core.server.impl.ServerSessionImpl.send(ServerSessionImpl.java:1001)
at org.hornetq.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:461)
at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:471)
at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:451)
at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:412)