Dynamic Queries and Streams

An overview of when to create and run dynamic queries and streams.

The ability to dynamically run or stop CCL statements and streams is useful if you have a system that is not static. For example, consider an application that monitors building security. The input events may come from door sensors, key-card readers, and smoke detectors, while the output events might include alerts to the security personnel or the fire department. Different queries are required on work days than on non-work days, and some queries need to run continuously while others should be activated or deactivated (automatically or via user intervention) based on the time of day and the day of the week.

The building security application might contain the following:

We can model this system as shown below. There are 3 input sources, 3 queries, and 2 destinations for alerts:

Sybase CEP Studio can be used to create a project that contains the Smoke Alarm input stream, the Fire Department output stream, and query Q1. The project can then be started and left to run indefinitely.

A project can also be created to have the Side Door input stream, the Guard output stream, and query Q2 running continuously.

To have the Front Door input stream and the query Q3 run only outside of normal working hours, a separate program can be used to register (create and run) them at the appropriate times. These streams would stop running during periods when they are not needed.