Questions and answers about Sybase CEP Studio and about data organization within Sybase CEP applications. Discusses Sybase CEP Studio and Sybase CEP Project functionality, the CCL module, workspaces, and so on.
Sybase CEP Studio is a User Interface application that lets users create streams and stream schemas, develop CCL queries, organize them into query modules and projects, compile and load projects into workspaces, load adapters, view streams at run-time, and so on.
Projects contain reusable groups of CCL queries (query modules), combined with one or more data streams and adapters. Every project includes at least one query module, which may contain one or more submodules. Projects must be loaded into a workspace for editing and execution, and, once loaded, appear under one of the workspaces in the Sybase CEP Studio. Project definition information is stored in a file with the extension .ccp, while query module code is stored in a file with the extension .ccl. After being compiled, projects are translated into a low-level language that can be executed by the Sybase CEP Server. The resulting .ccx files are not visible in Studio, but are executed when a project is started.
In its simplest form, a CCL query module is just a collection of CCL queries. CCL modules make it easy to organize queries into logical units, and also to organize a large application into easily manageable parts. Every Sybase CEP project contains at least one main query module, which may contain additional submodules. Query module code is stored in a file with the extension .ccl.
Yes, a module may optionally be parameterized with any of the following:
Input Streams: Formal names to be used for module input streams.
Output Streams: Formal names to be used for module output streams.
Parameters: Scalar parameters used at compile time.
For example, if developing a module that takes in a stream from an RFID reader, and counts the number of readings per unit of time, the module could look like this:
INSERT INTO RFIDCounts SELECT Count(*) FROM RFIDRaw KEEP 10 SEC OUTPUT EVERY 10 SEC;
This module hard-codes the names of the streams, as well as the parameter 10 SEC . But what if somebody wants to use this module with other input and output streams, and with a different interval? In this case, it is possible to define an interface to this module, consisting of formal input streams InRFIDRaw and OutRFIDCounts, and a parameter Duration. Then the query can be rewritten as:
INSERT INTO OutRFIDCounts SELECT Count(*) FROM InRFIDRaw KEEP $Duration SEC OUTPUT EVERY $Duration SEC;
Formal input and output stream names do not use the dollar sign character ($) but scalars do.
Parameters are specified in the Parameters tab for the module.
When a project containing the module is loaded, the connections for the stream and values for scalar parameters are specified in the Bindings tab.
The notion of formal names and connections is modeled on how parameters are passed to functions in any high-level language like C++ or Java. Each function declares formal parameters and uses them. When the function is called, the caller binds actual values (in this case called connections) to the formal values.
CCL goes far beyond SQL in its concepts of modules and parameterized modules. Unlike CCL, SQL does not let you create a set of queries and then apply them to different tables.
Workspaces are used to isolate different users or projects from one another within the Sybase CEP Engine. You and/or your system administrator decide exactly how many workspaces to use and how to use these. For example, you may decide that each user should get their own workspace, and that there should be a shared test workspace, a production workspace, and so on. By default, each Sybase CEP environment comes with one enabled workspace. This workspace is called Default. The Sybase CEP Studio allows you to create and destroy workspaces, and to connect or disconnect from workspaces. You may connect to a single workspace, or to multiple workspaces, running on the same or different Servers. For more information about working with workspaces in Studio, please see the Sybase CEP Studio Guide.
An environment contains the list of workspaces to which Studio users are connected. The environment configuration is stored in a .cce file. An environment is strictly a Studio feature, and does not exist on the Server. If you close Studio and then reopen it, it opens to the same environment, containing the same workspaces as it did before it was last closed.
The Sybase CEP Studio allows you to view every stream in the system, including streams connected to main modules, or their submodules, input and output streams and so on. For instructions on viewing a stream, please see the Sybase CEP Studio Guide. A debugging feature is also available in the stream viewer. This feature allows you to "step through" the rows in a stream and determine what other rows in other streams arrived at the same time, or shortly before or after, the selected row. Debugging features are also discussed in the Sybase CEP Studio Guide.
Look at the icon to determine the status of a project (a project contains your query or a submodule with your query). When the project is not running, its icon looks like this: . When the project is running with no problems, the icon looks like this:
. If the project encounters a problem, its icon looks like this:
. If a project is not running properly, select it, and look at the Studio Status View and Output View for information about its status. The Status View shows the project's status, while the Output View lists any errors encountered by the project.
Sybase CEP uses several kinds of files:
.ccp files contain information about the Sybase CEP project, including the parameter and stream information of the project's main module. .ccp files are often called project files, and, when loaded, appear in the Sybase CEP Studio as projects.
.ccl files are XML files, which contain CCL statements (queries). Every query module is contained in its own .ccl file. These files also store parameter and input/output stream information associated with the current module's submodules.
.ccs files are Studio-created XML files that contain schema definitions. These schemas define the column names and datatypes of data streams, windows, and database subqueries.
Sample data files are contained in .csv (comma separated values) files. The .csv files that come with your Sybase CEP Engine are a part of the examples included with every Sybase CEP installation. These files must reside in the same location as the Sybase CEP Server in order for examples to run properly. You may also find it useful to create your own sample data files during the application development and testing phases.
.ccp, .ccl, and .ccs files reside on the same machine as your Sybase CEP Studio installation. These files may be checked into a source control system, if desired. The files are compiled by Sybase CEP Studio and sent to the Server automatically when you run a project.
Sybase CEP also uses two other kinds of files, although you do not need to modify these files in any way under normal circumstances.
.cce files contain Studio configuration information, such as the list of open workspaces.
.ccx files contain compiled .ccl files. .ccx files are produced by the CCL compiler and are sent by Studio to the Server.