Broker 10.5 | webMethods Broker Documentation | webMethods Broker Administration Java API Programmer’s Guide | Using Queue Browsers | Viewing Queue Content | Administratively Viewing Contents of a Locked Forwarding Queue
 
Administratively Viewing Contents of a Locked Forwarding Queue
For an administrative client to create a queue browser and examine forward queue content in a locked mode, follow these steps.
1. Create a queue browser in locked mode using the BrokerAdminClient.createLockedForwardQueueBrowser(Stringremote_broker_name) method. This will acquire a queue lock to prevent further changes to the forward queue. Note that even though the target queue is locked, the Broker will continue to queue incoming documents according to the remote Broker's subscription. Acquiring a Queue Lock for instructions.
2. Set a filter or filters, if needed. Note that once a filter is set for the queue browser, all browse operations will only operate on documents that pass through the filters. See Filters on a Queue Browser for instructions.
3. Use browseEvents to view the content of the queue. See BrokerQueueBrowser and BrokerClientQueueBrowser for instructions.
The following example illustrates how to examine a forwarding queue in LOCKED mode:
BrokerAdminClient admin = null;
BrokerLockedQueueBrowser 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 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 on remote Broker
try {
browser = admin.createLockedForwardQueueBrowser(remote_broker_name);
} catch(BrokerException ex) {
System.out.println("Failed to create locked forward 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 locked queue browser.");
return;
}