3
votes

I want to list jms messages in hornetmq queue on jboss 7.1.1

I've tried several approaches :

  1. Using QueueBrowser - always empty list
  2. listJmsqserverControl.listMessages(null) - getting exception
  3. Calling method "list-messages" on the MXBean - always empty list

It looks like Hornetmq is a block box.

Can anyone advice my on how to list messages in hornetmq queue?
Or maybe better to switch to the other JMS broker?

2
Take a look to 'Core Queue Management' part of documentation. you can invoke operations on queues, defined in org.hornetq.api.core.management.QueueControl class, by sending a special (management) message to "hornetq.management" queue.Arya

2 Answers

7
votes

via jboss-cli.sh {locate jboss-cli.sh, connect}

[[email protected]:9999 /] /host=node1/server=server1/subsystem=messaging/hornetq-server=default/jms-queue=ExpiryQueue:list-messages-as-json

{Hint - use tabs in jboss-cli to get auto complete{

[[email protected]:9999 /] /host=node1/server=server1/subsystem=messaging/hornetq-server=default/jms-queue=ExpiryQueue:count-messages { "outcome" => "success", "result" => 93476L }

3
votes

Try with jboss-cli, pausing the queue:

/subsystem=messaging/hornetq-server=default/jms-queue=<Queue-name>/:pause

and after list the messages:

/subsystem=messaging/hornetq-server=default/jms-queue=<Queue-name>/:list-messages 

Then resume, when you are done:

/subsystem=messaging/hornetq-server=default/jms-queue=<Queue-name>/:resume