Administratively Viewing Contents of an Unlocked Forwarding Queue
For an administrative client to examine forwarding queue content in an unlocked mode, follow these steps.
1. Create a queue browser in an unlocked mode using the BrokerAdminClient.createForwardQueueBrowser(Stringremote_broker_name) method. This will create a queue browser on the forwarding queue for the specified remote Broker.
Stringremote_broker_name: Name of the remote Broker.
Note:
This mode of operation does not require a forwarding queue to be locked; therefore the forwarding queue content can undergo changes while the queue browser is open.
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.
The following example illustrates how to examine a forward queue in unlocked mode:
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 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.createForwardQueueBrowser(remote_broker_name);
} catch(BrokerException ex) {
System.out.println("Failed to create 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 queue browser.");
return;
}