Broker 10.5 | webMethods Broker Documentation | webMethods Broker Administration Java API Programmer’s Guide | Using Queue Browsers | Viewing Queue Content | Viewing a Client's Own Queue Content
 
Viewing a Client's Own Queue Content
For a client to create a queue browser on its own queue and browse documents, follow these steps.
1. Create a queue browser using the BrokerClient.createClientQueueBrowser() method. This will create a 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.
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 one's own queue content:
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 - SELF",
null);
} catch(BrokerException ex) {
System.out.println("Failed to create client.");
return;
}
. . .
//Create a queue browser
try {
browser = client.createClientQueueBrowser();
} 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;
}