Getting Started: Maintaining State

Maintaining state enables you to perform aggergate calculations. There are four ways to maintain the state in the Sybase CEP Engine.

Maintaining State: Overview

In the Filtering Data tutorial, you worked with queries that examined rows individually. In those queries, rows arrive, are processed, and are gone. Most applications require that Sybase CEP Engine maintain state, that is, retain multiple rows in order to perform calculations or comparisons across those rows. In this tutorial, you will work with a query that calculates the average sales price over several transactions for specific stock symbols. Maintaining state and performing aggregate calculations are critical tasks for a variety of applications, such as calculating the average temperature over several thermometer readings, determining the total spending per visitor to a Web site over a given time period, or counting the number of times an object passes the same sensor in a manufacturing plant.

Objectives

After completing this tutorial, you will be able to:

  • Compose CCL code to retain multiple rows.

  • Describe four different ways that you can maintain state with Sybase CEP Engine.

  • List the CCL components that calculate averages, sums, and counts.

Before You Begin

Before you begin the activities in this tutorial, be sure you have access to the following:

  • An instance of Sybase CEP Server running on your computer. If you don't have such an instance, follow the directions in Installing and Starting Sybase CEP Server . Note that attempting to complete the tutorial while connected to a remote instance of Sybase CEP Server will not work because of the data files used in the tutorial.

  • Sybase CEP Studio installed on your computer. If you have not installed Sybase CEP Studio, follow the directions in Installing Sybase CEP Studio .

  • The completed StockFilter project from the Filtering Data tutorial.