Implementing a Continuous Query

You can specify CQs for any client region.

Here are the high-level steps for implementing a continuous query, with links to more detailed information in this chapter.

  1. Make sure your system is configured properly to run CQs. See Configuring for Continuous Querying.
  2. Decide what data to track on the server and write your queries. Use your criteria for tracking data changes to write your CQ queries. See Writing the Continuous Query.
  3. Determine how to handle the CQ events on the client and write your listeners.

    Each CQ can have any number of listeners. In addition to your core CQ listeners, you might have listeners that you use for all CQs to track statistics or other general information. See Writing the CQ Listener.

  4. The CqEvent object contains information about the CQ event.

  5. Write the client code to put the queries and their listeners into named CQ queries and execute the queries. Make sure you close the queries if your client no longer needs them and when the client exits. See Running the Continuous Query Code.

  6. CQ Execution Options.

  7. When an Error Occurs in a Running CQ.

  8. Run your code, monitor and tune as needed.