Search code examples
javajbossjmshornetqjms-topic

How to call operations on JMS temporary queue from JBOSS CLI


I am trying to call operations such as listDeliveringMessages() on a temporary Queue (say fe517553-6c53-42d6-8aaa-d8ea154fd8b0), created by a jms.Topic in JBoss 6.4.0.GA EAP / 7.2.x. I need to do that from JBoss CLI.

I got close to do that by running:

/subsystem=messaging/hornetq-server=default/jms-queue=fe517553-6c53-42d6-8aaa-d8ea154fd8b0

But the JBoss CLI says that the queue is not found. Yet, If i approach this from JVisualVM and check the MBeans, I can run the operations visually (which is not what I am looking for!):

queue

And when selecting that I can have a list of all attributes:

enter image description here

What command should I run to get the same attributes and call operations from JBoss CLI?


Solution

  • Queues used for topic subscriptions can be found in runtime-queue. For example, if you created a subscriber on a topic called myTopic you could run this command:

    /subsystem=messaging/hornetq-server=default/jms-topic=myTopic/:list-all-subscriptions
    

    That would give you information on all the current subscribers including the name of the subscription queue, e.g.:

    {
        "outcome" => "success",
        "result" => [{
            "durable" => false,
            "queueName" => "6257c1d9-9039-4e76-a4cd-857de77f13a8",
            "messageCount" => 0,
            "deliveringCount" => 0,
            "consumers" => [{
                "creationTime" => 1535727397857L,
                "consumerID" => 0,
                "browseOnly" => false,
                "connectionID" => "397639080",
                "sessionID" => "0fb5712d-ad2e-11e8-94a8-45dabcb25ee3"
            }]
        }]
    }
    

    Then you can take the name of the subscription queue and look it up with a command like the following:

    /subsystem=messaging/hornetq-server=default/runtime-queue=6257c1d9-9039-4e76-a4cd-857de77f13a8:read-resource(include-runtime=true)
    

    That would tell you all the properties of the queue, e.g.:

    {
        "outcome" => "success",
        "result" => {
            "consumer-count" => 1,
            "dead-letter-address" => "jms.queue.DLQ",
            "delivering-count" => 0,
            "durable" => false,
            "expiry-address" => "jms.queue.ExpiryQueue",
            "filter" => undefined,
            "id" => 52L,
            "message-count" => 0L,
            "messages-added" => 0L,
            "paused" => false,
            "queue-address" => "jms.topic.myTopic",
            "scheduled-count" => 0L,
            "temporary" => true
        }
    }
    

    However, the list-all-delivering-messages operation doesn't appear to be supported for this queue.