Sun GlassFish Message Queue 4.4 Administration Guide

Purging a Physical Destination

Purging a physical destination deletes all messages it is currently holding. You might want to do this when a destination’s accumulated messages are taking up too much of the system’s resources, such as when a queue is receiving messages but has no registered consumers to which to deliver them, or when a topic’s durable subscribers remain inactive for long periods of time.

To purge a physical destination, use the imqcmd purge dst subcommand:

   imqcmd purge dst  -t destType  -n destName

For example, the following command purges all accumulated messages from the topic destination hotTopic:

   imqcmd purge dst  -t t  -n hotTopic  -u admin

Note –

In a broker cluster, since each broker in the cluster has its own instance of each physical destination, you must purge each such instance individually.

Tip –

When restarting a broker that has been shut down, you can use the Broker utility’s -reset messages option to clear out its stale messages: for example,

   imqbrokerd -reset messages  -u admin

This saves you the trouble of purging physical destinations after restarting the broker.