Sun GlassFish Message Queue 4.4 Administration Guide

Managing Durable Subscriptions

Message Queue clients subscribing to a topic destination can register as durable subscribers. The corresponding durable subscription has a unique, persistent identity and requires the broker to retain messages addressed to it even when its message consumer (the durable subscriber) becomes inactive. Ordinarily, the broker may delete a message held for a durable subscriber only when the message expires.

The Message Queue Command utility provides subcommands for managing a broker’s durable subscriptions in the following ways:

To list durable subscriptions for a specified physical destination, use the imqcmd list dur subcommand:

   imqcmd list dur  -d topicName

For example, the following command lists all durable subscriptions to the topic SPQuotes on the default broker (host localhost at port 7676):

   imqcmd list dur  -d SPQuotes

The resulting output lists the name of each durable subscription to the topic, the client identifier to which it belongs, its current state (active or inactive), and the number of messages currently queued to it. Example 7–6 shows an example.

Example 7–6 Durable Subscription Information Listing

Name        Client ID       Number of   Durable Sub
                            Messages      State
myDurable   myClientID       1           INACTIVE

The imqcmd purge dur subcommand purges all messages for a specified durable subscriber and client identifier:

   imqcmd purge dur  -n subscriberName
                     -c clientID

For example, the following command purges all messages for the durable subscription listed in Example 7–6:

   imqcmd purge dur  -n myCurable  -c myClientID

The imqcmd destroy dur subcommand destroys a durable subscription, specified by its subscriber name and client identifier:

   imqcmd destroy dur  -n subscriberName
                       -c clientID

For example, the following command destroys the durable subscription listed in Example 7–6:

   imqcmd destroy dur  -n myCurable  -c myClientID