Canceling a Subscription
Your application can cancel an event subscription by calling the BrokerClient.cancelSubscription method. The example below contains an excerpt from a sample application that shows how you can use this method. This method accepts these parameters:
The event type name, which can optionally contain a wildcard at the end.
The event filter string that was specified with the original specification. A
null value can be specified if event filtering was not specified in the original subscription. Event filters are described in
Using Event Filters.
BrokerClient c;
. . .
/* Cancel the subscription */
try {
c.cancelSubscription("Sample::SimpleEvent",null);
} catch (BrokerException ex) {
System.out.println("Error on canceling subscription\n"+ex);
return;
}
. . .