Managing Continuous Queries

This section discusses how to access and manage your CQs from your client. The calls discussed here are all executed specifically for the calling client. A client cannot access or modify the CQs belonging to another client.

This section discusses how to access and manage your CQs from your client. The calls discussed here are all executed specifically for the calling client. A client cannot access or modify the CQs belonging to another client.

For detailed method usage, see the API documentation for the C++ API or the .NET API.

Accessing CQs and CQ Statistics

You can use the QueryServicegetCq* methods to access a single named CQ, an array of all CQs registered, and an array of all CQs registered in the client. You canuse the CqEvent.getCq method to access the CQ used to produce a CqEvent.

CQ runtime statistics are available for the client through the CqServiceStatistics and CqStatistics interfaces described under CQ API and Main Features. You can get information on the events generated by a specific CQ from the CqStatistics object returned by CqQuery.GetStatistics. You can get higher-level information about the CQs the client has registered, running, and so on, from the CqServiceStatistics object returned by QueryService.GetCqStatistics .

Client statistics are for the single client only. The server’s pertain to all clients with CQs on this server.

Modifying CQ Attributes

You can modify the attributes for an existing CQ using the methods provided by CqQuery.GetCqAttributesMutator. The attributes consist of a list of listeners.

Stopping and Closing CQs

You stop individual CQs with the CqQuerystop method. You can stop all CQs for the client through the QueryService. Stopped CQs are in the same state as new CQs that have not yet been executed. You can close or execute a stopped CQ.

You close individual CQs with the CqQueryclose method. You can also close all CQs for the client through the QueryService. Closed CQs cannot be executed. CQs are also closed in the following cases:

  • The client closes its cache after closing all of its CQs–Closing the client cache closes the QueryService and all associated CQs on the client and server.
  • The client disconnects from its server–This might be because of a network outage or some other failure. When a client disconnects, all CQs created by the client are removed from the server and put into a CLOSED state on the client.
  • The server region is destroyed–When a server region is destroyed, all associated CQs are also cleaned up on the server and the region destroy event is sent to the client. On the client, the CqListener.Close method is called for all CQs on the region.

Getting All Durable CQs Registered with the Server

To obtain a list of all durable CQs registered on the server, use the QueryService.getAllDurableCqsFromServer API.