In-process Adapter API

This section provides an introduction to in-process adapter API signatures, their purposes, and parameters.

These in-process adapter API signatures are defined in c8adapter_in_process.h.

Each adapter is executed in its own thread. initialize(), execute(), and shutdown() are always called from this thread.

For input adapters, the will call the execute() function function as often as possible.

For output adapters, the Sybase CEP Engine will call the execute() function on a periodic basis. Check for message availability; there can be an arbitrary number of messages (0, 1, or more than 1) available for any single call of the execute() function. The output adapter is responsible for processing the messages and should then return control to the .

The following GetParam() functions interface with the ADL files. Please refer to Adapter Definition Language for detailed descriptions of how to use ADL files. All the GetParam names are displayed in the adapter Properties View in Sybase CEP Studio and are configurable. Parameters can access the original string form as displayed in by calling C8AdapterGetParamString(). If you have additional data types C8AdapterGetParamString() is the appropriate function call. After obtaining the string, you can call one of the data conversion functions supplied by Sybase CEP.

The name string should be identical to the string provided in the ADL file. For instance, if the ADL file contains

<Parameter Name="TitleRow" xsi:type="xsi:boolean">

then the name should be TitleRow. It is important to match the case. Using an unknown name results in the default value being returned.

Note: In the following functions, the *name parameter can specify a parameter of any data type at all. This can be convenient for user-defined data types. The returned pointer must be released by C8Free() to prevent a memory leak.

Below is sample pseudo code showing how C8AdapterSetPersistentState() and related functions are typically used.

initialize()
{
pMem = C8Malloc(...);
...
C8AdapterSetPersistentState(..., pMem, ...);
...
}
execute()
{
pMem = C8AdapterGetPersistentState(...);
...
}

Remember that if the allocated memory itself contains pointers or handles, those must be cleaned up too.