Using imqcmd subcommands you can manage a broker’s durable subscriptions by doing one or more of the following:
Listing durable subscriptions
Purging all messages for a durable subscription
Destroying a durable subscription
A durable subscription is a subscription to a topic that is registered by a client as durable; it has a unique identity and it requires the broker to retain messages for that subscription even when its consumer becomes inactive. Normally, the broker may only delete a message held for a durable subscriber when the message expires.
To list durable subscriptions for a specified physical destination, use the list dur subcommand. This is the syntax for the list dur subcommand:
imqcmd list dur -d destName
For example, the following command lists all durable subscriptions to the topic SPQuotes, using the broker at the default port on the local host:
imqcmd list dur -d SPQuotes
For each durable subscription to a topic, the list dur subcommand returns the name of the durable subscription, the client ID of the user, the number of messages queued to this topic, and the state of the durable subscription (active/inactive). For example:
Name Client ID Number of Durable Sub Messages State ---------------------------------------------------------------- myDurable myClientID 1 INACTIVE |
You can use the information returned from the list dur subcommand to identify a durable subscription you might want to destroy or for which you want to purge messages.
The purge dur subcommand purges all messages for the specified durable subscription with the specified Client Identifier. This is the syntax for the purge dur subcommand:
imqcmd purge dur -n subscrName -c clientID
The destroy dur subcommand destroys a specified durable subscription with the specified client identifier. This is the syntax for the destroy dur subcommand:
imqcmd destroy dur -n subscrName -c clientID
For example, the following command destroys the durable subscription myDurable and clientID, myClientID.
imqcmd destroy dur -n myDurable -c myClientID