Broker 10.15 | webMethods Broker Documentation | webMethods Broker Administration Java API Programmer’s Guide | Using Queue Browsers | Queue Position
 
Queue Position
The browse operation of a queue browser is a position-based operation. A queue browser internally maintains a cursor that points to a valid queue position anywhere between the head to the tail of the queue (between 0 to "queue length minus one"). Upon creation of a queue browser, the cursor is set to point to the head of the queue. After the browse operation, the cursor then points to the next document position for the following browse operation.
For example, if the cursor points to a queue position of 200 and the browse operation is for 10 documents, the queue browser returns 10 documents from the current position of 200 to position 209. After the browse operation, the cursor is now pointing at position 210 in the queue for the next browse operation.
You can alter queue position at any point of time using the setPosition method. Any subsequent browse operation will start browsing documents from that queue position.
The following example illustrates how to set the cursor position to queue position 200:
BrokerQueueBrowser browser = null;
 
. . .
//Create a queue browser
...
//Set queue position
try {
browser.setPosition( 200); //Set at queue position 200
} catch(BrokerException ex) {
System.out.println("Failed to set queue position.");
return;
}
. . .
//Various queue browser operations
. . .
//Close the queue browser
try {
browser.closeQueueBrowser();
} catch(BrokerException ex) {
System.out.println("Failed to close queue browser.");
return;
}