Method UnRegisterCQ
UnRegisterCQ(ContinuousQuery)
Unregisters an already registered continuous query to deactivate it on the cache server. Like RegisterCQ, it takes as argument an object of ContinuousQuery to unregister the callbacks which are no more fired after this call.
This method is used when the user is no more interested in receiving notifications for changes in a query result set.
Declaration
void UnRegisterCQ(ContinuousQuery query)
Parameters
Type | Name | Description |
---|---|---|
ContinuousQuery | query | SQL-like query to be executed over the cache. |
Examples
The following example demonstrates how to unregister a Continuous Query on the cache.
ICache cache = CacheManager.GetCache("demoCache");
string queryString = "SELECT MyApplication.Employee WHERE this.Salary > ?";
QueryCommand queryCommand = new QueryCommand(queryString);
queryCommand.Parameters.Add("Salary", 50000);
ContinuousQuery continuousQuery = new ContinuousQuery(queryCommand);
continuousQuery.RegisterNotification(new QueryDataNotificationCallback(query_ItemAdded), EventType.ItemAdded, EventDataFilter.None);
continuousQuery.RegisterNotification(new QueryDataNotificationCallback(query_ItemUpdated), EventType.ItemUpdated, EventDataFilter.DataWithMetadata);
continuousQuery.RegisterNotification(new QueryDataNotificationCallback(query_ItemRemoved), EventType.ItemRemoved, EventDataFilter.None);
cache.MessagingService.RegisterCQ(continuousQuery);
cache.MessagingService.UnRegisterCQ(continuousQuery);