Broker 10.15 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Using Event Filters | Using Filters with Subscriptions
 
Using Filters with Subscriptions
When you subscribe to a particular event type using the BrokerClient.newSubscription method, you can specify an optional event filter string. The filter string you specify will be used by the Broker when determining if an event should be placed in your Broker client's event queue. Only those event types for which your Broker client has subscribed that also match the filter specification will actually be placed into your Broker client's event queue. The following example shows how to create an event filter string and use it with an event subscription.
BrokerClient c;
String filter_string;
. . .
filter_string = "(A<B) and ((C+12) > (D*3))";
. . .

/* Make a subscription */
try {
c.newSubscription("Sample::SimpleEvent",filter_string);
} catch (BrokerException ex) {
System.out.println("Error on create subscription\n"+ex);
return;
}
. . .