Reference: JMS Queue Management
The management operations on a JMS queue are very similar to the operations on a core queue. Expiring, sending to a dead letter address and moving messages Messages can be expired from a queue by using the expireMessages() method. If an expiry address is defined, messages will be sent to it, otherwise they are discarded. The queue's expiry address can be set with the setExpiryAddress() method. Messages can also be sent to a dead letter address with the sendMessagesToDeadLetterAddress() method. It returns the number of messages which are sent to the dead letter address. If a dead letter address is not defined, message are removed from the queue and discarded. The queue's dead letter address can be set with the setDeadLetterAddress() method. Messages can also be moved from a queue to another queue by using the moveMessages() method. Listing and removing messages Messages can be listed from a queue by using the listMessages() method which returns an array of Map, one Map for each message. Messages can also be removed from the queue by using the removeMessages() method which returns a boolean for the single message ID variant or the number of removed messages for the filter variant. The removeMessages() method takes a filter argument to remove only filtered messages. Setting the filter to an empty string will in effect remove all messages. Counting messages The number of messages in a queue is returned by the getMessageCount() method. Alternatively, the countMessages() will return the number of messages in the queue which match a given filter Changing message priority The message priority can be changed by using the changeMessagesPriority() method which returns a boolean for the single message ID variant or the number of updated messages for the filter variant. Message counters Message counters can be listed for a queue with the listMessageCounter() and listMessageCounterHistory() methods (see Section 30.6, “Message Counters�) Retrieving the queue attributes The JMSQueueControl exposes JMS queue settings through its attributes (e.g. isTemporary() to know whether the queue is temporary or not, isDurable() to know whether the queue is durable or not, etc.) Pausing and resuming queues The JMSQueueControl can pause and resume the underlying queue. When the queue is paused it will continue to receive messages but will not deliver them. When resumed again it will deliver the enqueued messages, if any.