For an Administrative Queue Browser With No Lock
Create a queue browser using the
BrokerAdminClient.createForwardQueueBrowser() method. This creates an administrative queue browser on the forwarding queue for the remote
Broker.
Note:
This mode of operation does not require a queue to be locked; therefore the queue content can undergo changes while the queue browser is open.
Close the queue browser using
BrokerClientQueueBrowser.closeQueueBrowser() method.
The following example illustrates an administrative queue browser on a forwarding queue (UNLOCKED mode):
BrokerAdminClient admin = null;
BrokerQueueBrowser browser = null;
//Create a Broker admin client
try {
admin = new BrokerAdminClient(broker_host,
broker_name,
null,
"admin",
"ForwardQueueBrowser-UNLOCKED",
null);
} catch(BrokerException ex) {
System.out.println("Failed to create admin client.");
return;
}
. . .
//Create a queue browser in unlocked mode
try {
browser = admin.createForwardQueueBrowser(remote_broker_name);
} catch(BrokerException ex) {
System.out.println("Failed to create forward queue browser.");
return;
}
. . .
//Various browse operations
. . .
//Close the queue browser
try {
browser.closeQueueBrowser();
} catch(BrokerException ex) {
System.out.println("Failed to close forward queue browser.");
return;
}