Each user-defined adapter must provide three or four entry points in order to function. Introduces these adapter functions, their purposes, and parameters.
The entry points are identical for both input and output adapters, though the internal logic will differ. Refer to the In-Process Input Adapterand In-process Output Adapter sections and the examples for details on function implementation.
While the actual function names are arbitrary, the names must match the names specified in the ADL file. If the names are missing or do not match, a fatal runtime error will result.
For example, part of the ADL file may look like:
<LibraryName> my_input_adapter_lib </LibraryName> <InitializeFunction> my_input_adapter_init </InitializeFunction> <ExecuteFunction> my_input_adapter_execute </ExecuteFunction> <ShutdownFunction> my_input_adapter_shutdown </ShutdownFunction> <ReconnectFunction> my_input_adapter_reconnect </ReconnectFunction>
The corresponding C function signatures would be:
C8Bool my_input_adapter_init(C8Adapter* i_adapter_ptr); C8Bool my_input_adapter_execute(C8Adapter* i_adapter_ptr); void my_input_adapter_shutdown(C8Adapter* i_adapter_ptr); C8Bool my_input_adapter_reconnect(C8Adapter* i_adapter_ptr);
You can perform file opening and socket connections in anticipation of adapter execution. Depending on adapter needs, the session state may or may not be created.
Parameters:
i_adapter_ptr: A pointer to a set of information about this instance of the adapter.
Returns: If the adapter is properly initialized, the routine will return C8_TRUE. If the adapter cannot initialize, you can issue appropriate error messages, release any allocated Sybase CEP resources, and return C8_FALSE. If the Sybase CEP Engine receives a C8_FALSE, the adapter isconsidered inactive and no further communications will be attempted.
Parameters:
i_adapter_ptr: A pointer to a set of information about this instance of the adapter.
Returns: On successful processing, the execute function will return C8_TRUE. As long as the execute function returns C8_TRUE, the execute function will be called again. If a problem is encountered, you are expected to issue appropriate error messages and return C8_FALSE. The Sybase CEP Engine will then call the shutdown function, call the initialization function, and call the execute function exactly one more time. If this last call to the execute function returns C8_FALSE, the adapter is considered dead and will no longer be called. This logic exists to accommodate cases of disconnection.
Parameters:
i_adapter_ptr: A pointer to a set of information about this instance of the adapter.
Returns: Nothing.
Parameters:
i_adapter_ptr: A pointer to a set of information about this instance of the adapter.
Returns: C8_TRUE on successful reconnection, C8_FALSE on failure.