Broker 10.15 | webMethods Broker Documentation | webMethods Broker Administration Java API Programmer’s Guide | Using Queue Browsers | Viewing Queue Content | Identifying "Unacknowledged" Documents
 
Identifying "Unacknowledged" Documents
A queue browse operation may return documents including those that are retrieved but not yet acknowledged. These documents are "unacknowledged" or "unacked" documents. The document acknowledgment status information can be retrieved from the returned BrokerEvent object using the following methods.
*Use the BrokerEvent.getRetrievedStatus() method to check whether the document is an unacknowledged or not. If the document is unacked, this method returns "true".
*If the document is unacked, use the BrokerEvent.getRetrievedSessionId() method to get information on the client session that retrieved this document.
For more information about BrokerEvent, see the webMethods Broker Client Java API Programmer’s Guide.
The following example illustrates how to examine an "unack" status on documents returned from a browse operation:
BrokerAdminClient admin = null;
BrokerLockedQueueBrowser browser = null;
 
//Create a Broker admin client
try {
admin = new BrokerAdminClient(broker_host,
broker_name,
null,
"admin",
"QueueBrowser",
null);
} catch(BrokerException ex) {
System.out.println("Failed to create admin client.");
return;
}
. . .
//Create a queue browser
....

. . .
//Browse operation
try {
events = browser.browseEvents(max_events, msecs);
} catch(BrokerException ex) {
System.out.println("Failed to complete browse operation.");
return;
}
//Check unacked status
try {
for (int i=0; i< events.length; i++) {
if (events[i].getRetrievedStatus()) {
System.out.println("Event["+i+"] - "+events[i].getTypeName() "+
"has been retrieved by client session id "+
events[i].getRetrievedSessionId());
}
else {
System.out.println("Event["+i+"] - "+events[i].getTypeName() "+
" is available");
}
}
} catch(BrokerException ex) {
System.out.println("Failed to complete ack status check on browse result.");
return;
}
. . .
//Various browse operations
. . .
//Close the queue browser
try {
browser.closeQueueBrowser();
} catch(BrokerException ex) {
System.out.println("Failed to close queue browser.");
return;
}