For an Administrative Queue Browser With No Lock
Create a queue browser using the
BrokerAdminClient.createClientQueueBrowser() method. This creates an administrative queue browser on the client's queue.
Note:
This mode of operation does not require a client queue to be locked; therefore the client queue content can undergo changes while the queue browser is open.
Close the queue browser using
BrokerClientQueueBrowser.closeQueueBrowser() method.
The following example illustrates how to create an administrative queue browser on a client queue (UNLOCKED mode):
BrokerClient client = null;
BrokerAdminClient admin = null;
BrokerClientQueueBrowser 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-UNLOCKED",
null);
} catch(BrokerException ex) {
System.out.println("Failed to create admin client.");
return;
}
. . .
//Create a queue browser in unlocked mode
try {
browser = admin.createClientQueueBrowser(client.getId());
} catch(BrokerException ex) {
System.out.println("Failed to create client queue browser.");
return;
}
. . .
//Various browse operations
. . .
//Close the queue browser
try {
browser.closeQueueBrowser();
} catch(BrokerException ex) {
System.out.println("Failed to close client queue browser.");
return;
}