Setting a Single Filter on Queue Browser
Use the setFilter method to set up a single filter for queue browse operations. If the queue browser already has one or more filters, this new filter is added to the list. If a filter is already present for a document type, the existing filter will be overwritten with the new filter. When one or more filters are set for the queue browse operations, only documents matching those filters are processed.
The following example illustrates how to set a single filter:
BrokerAdminClient admin = null;
BrokerQueueBrowser browser = null;
BrokerFilterDescriptor filter =
new BrokerFilterDescriptor(""API::Test", "test_int < 10");
. . .
//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
. . .
//Set single filter
try {
browser.setFilter(filter);
} catch(BrokerException ex) {
System.out.println("Failed to set filter.");
}
. . .
//Various browse operations
. . .
//Close the queue browser
try {
browser.closeQueueBrowser();
} catch(BrokerException ex) {
System.out.println("Failed to close queue browser.");
return;
}