For a Administrative Queue Browser With a Lock
Create a queue browser using the
BrokerAdminClient.createLockedClientQueueBrowser() method. This method creates a locked administrative queue browser on the client's queue.
Close the queue browser using the
BrokerClientQueueBrowser.closeQueueBrowser() method.
The following example illustrates how to create an administrative queue browser on a client queue (LOCKED mode):
BrokerClient client = null;
BrokerAdminClient admin = null;
BrokerLockedClientQueueBrowser browser = null;
//Create a Broker client
try {
client = new BrokerClient(broker_host,
broker_name,
client_id,
client_group,
"QueueBrowser",
null);
} catch(BrokerException ex) {
System.out.println("Failed to create client.");
return;
}
//Create a Broker admin client
try {
admin = new BrokerAdminClient(broker_host,
broker_name,
null,
"admin",
"QueueBrowser-LOCKED",
null);
} catch(BrokerException ex) {
System.out.println("Failed to create admin client.");
return;
}
. . .
//Create a locked queue browser
try {
browser = admin.createLockedClientQueueBrowser(client.getId());
} catch(BrokerException ex) {
System.out.println("Failed to create locked client queue browser.");
return;
}
. . .
//Various queue browser operations
. . .
//Close the queue browser
try {
browser.closeQueueBrowser();
} catch(BrokerException ex) {
System.out.println("Failed to close client queue browser.");
return;
}