Broker 10.5 | webMethods Broker Documentation | webMethods Broker Administration Java API Programmer’s Guide | Using Queue Browsers | Viewing Queue Content | Administratively Viewing Contents of an Unlocked Client Queue
 
Administratively Viewing Contents of an Unlocked Client Queue
For an administrative client to examine client queue content in an unlocked mode, follow these steps.
1. Create a queue browser in an unlocked mode using the BrokerAdminClient.createClientQueueBrowser(String client_id) method. This will create a queue browser on the specified 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.
2. Set a filter or filters, if needed. It is important to note that once a filter is set for the queue browser, all browse operations will consider only documents that pass the filters. See Filters on a Queue Browser for instructions.
3. Use browseEvents to view the content of the queue. See BrokerLockedQueueBrowser and BrokerLockedClientQueueBrowser for instructions.
The following example illustrates how to examine a client queue in unlocked mode:
BrokerClient client = null;
BrokerAdminClient admin = null;
BrokerQueueBrowser browser = null;
BrokerEvent[] events = null;
int max_events = 100; //Maximum number of documents to be browsed
int msecs = 30000; //Timeout for the browse operation
 
//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;
}
. . .
//Browse operation
try {
events = browser.browseEvents(max_events, msecs);
} catch(BrokerException ex) {
System.out.println("Failed to complete browse operation.");
return;
}
. . .
//Various browse operations
. . .
//Close the queue browser
try {
browser.closeQueueBrowser();
} catch(BrokerException ex) {
System.out.println("Failed to close queue browser.");
return;
}