Printing a Parameter

Sybase CEP Studio provides a Properties View for each instance of an adapter. Each instance can have different run-time parameters. This section provides an example for printing parameters.

There can be multiple instances of each adapter present. Each instance of your in-process adapter is run in a separate thread.

Access to the individual values for each parameter ensures proper configuration. This parameter value retrieval is normally performed as an initialization step. Each parameter must be retrieved according to its own datatype. The specific datatype retrieved corresponds to the xsi:name in the ADL file. The correspondence is shown in the table below:

C8_TYPES

xsi:name

C8_CHAR_PTR

xsi:string

C8_INT

xsi:integer

C8_LONG

xsi:long

C8_BOOL

xsi:boolean

C8_TIMESTAMP

xsi:timestamp

C8_INTERVAL

xsi:interval

C8_FLOAT

xsi:double

While there is currently no API function to retrieve the data type of a parameter in the ADL file, parameter data types change infrequently. Attempting to retrieve a parameter with the incorrect data type results in an error message on Sybase CEP Server log and an undefined value returned to the user SDK.

An example of printing C8Int data types would be:

static
void DumpParamInt(C8Adapter*i_adapter_ptr, C8Char*i_param_name)
{
    C8Int l_param_value;
    l_param_value = C8AdapterGetParamInt(i_adapter_ptr, 
                   i_param_name, 0);
    printf("Parameter Int %s=%d\n", i_param_name, l_param_value);
}

In the C8AdapterGetParamInt() call, the third parameter is the default parameter. If the SDK cannot find the parameter for some reason, this value becomes the function return value. Default parameters exist because users can choose not to enter these values on the adapter's Properties View in Sybase CEP Studio. It is not currently possible to determine if the value has been defaulted or if the user has chosen not to assign a value to the parameter.

Obtaining data from other data types is involves the same process with different GetParam() data type function calls.