This section provides tips useful for testing and debugging your in-process adapter.
In the initialization code, query and print the parameters that Sybase CEP Studio provides through the C8AdapterGetParamInt() type calls. This provides assurance of proper communication and updating with Sybase CEP Studio.
The initialization function is also a good place to print the current working directory. The sample code provides an #ifdef to call the proper system function switch regardless of whether you are on Microsoft Windows or one of the UNIX-like operating systems.
You can create and use an ADL file without writing the C/C++ code for the in-process adapter. To do this, put the ADL file in Studio's plugins directory and use it in Sybase CEP Studio. This allows you to do some basic testing of the ADL file and also to show the parameters to potential users and allow them to comment.
Sybase CEP Server and Sybase CEP Studio only read ADL files and library files when they start, so you must restart both the Server and Sybase CEP Studio any time you copy an updated ADL file to the plugins directory or copy an updated library file to the bin directory.
All parameters known to Sybase CEP Studio for a specific ADL instance can be printed to stdout by a call to PrintParamsAsStrings(). This can be useful in resolving some kinds of problems. A discrepancy between expected and display values may indicate a missing update for an adapter or library file. Experimenting with exceptionally large or small values can also encounter overflow/underflow problems.
If there are problems with obtaining typed parameters from Sybase CEP Studio, parameters of any data type can be retrieved as a string with C8AdapterGetParamString(). This could be useful for user data types that do not conform to Sybase CEP data types. You can display the data type as a string, retrieve with C8AdapterGetParamString()and convert with a specialized conversion routine. Remember to C8Free() the returned pointer.
If you use the Persistence feature, the Server stores persistent data in a directory named storage. This is why a stream will begin immediately upon server invocation even when Sybase CEP Studio has not selected the "Start Stream" function. This is a feature and not a bug. To stop this action for debugging, remove the directory name storage in the server execution directory. Do this only on a development system, not a production system. These directories may be different for release and debug versions. Another way is to select the "Run with clean slate" from the Sybase CEP Studio "Run" pull-down menu. This will cause persistence to be reinitialized before execution begins.
In the course of development, the storage directory should be cleared. If the stream is persisted and not removed, schema changes or normal starting and stopping can display erratic behavior. Removing the storage directory requires re-creation of the workspace as well.
C8AdapterGetParamString() can be used to differentiate between a zero value and any empty string. If the parameter field is an integer, and C8AdapterGetParamInt()is called, there is no difference between a 0 value and an empty field. By calling C8AdapterGetParamString() you can detect the difference.
To avoid generating overwhelming amounts of data during early testing phases, consider calling the C8Sleep() function between each row you send. When testing an output adapter, use an input adapter that is configured to send data at a slow rate.
The libraries distributed by Sybase CEP do not contain debugging information but a debugger can be used.