The Connection Plug-in is highly customizable and unique implementations can be written using C or C++.
//initialize the connection plugin C8Bool C8FIXConnInitialize(); //send message to message source C8Bool C8FIXConnSendMessage( const void* message) //shutdown plug-in, disconnect to the message source C8Bool C8FIXConnShutdown();
The C8FIXConnInitialize() function is called by the FIX Adapter when it starts up. Any initialization required by the plug-in, such as establishing a connection to the FIX message source, must be performed here.
The C8FIXConnSendMessage() function is called by the FIX Adapter after it receives a tuple from the CEP server and has converted the tuple into a FIX message via the Data Mapping plug-in C8FIXDMConvertToFIX() function. The FIX message that is passed as the parameter of this function call is of the form returned by the Data Mapping plug-in C8FIXDMConvertToFIX() function.
The C8FIXConnShutdown() function is called by the FIX Adapter when the adapter is shutting down. Any clean-up required by the plug-in must be performed here.
The functions can have any name but they must match the configuration file you intend to use. The function signatures must conform to what is noted above. When using C++ to write a custom Connection Plug-in, ensure that the functions above use C-style calling conventions and name mangling.
For the FIX Adapter to function as an input adapter, set the Connection Plug-in to receive FIX messages from the message source. Once a FIX message has been received, the plug-in notifies the FIX Adapter by invoking the following function:
//callback from the Connection Plug-in to notify the FIX Adapter //that a FIX message was received from the external datasource FIX_ADAPTER_EXPORT C8Bool C8FIXMessageReceived( void* message, char* msgType, char* sessionId );
The Connection plug-in can also log messages through the Adapter by calling the following functions, which are similarly declared in c8_fix_adapter.h:
//log messages/errors through the FIX adapter FIX_ADAPTER_EXPORT void C8FIXLogMessage( C8Int i_err_code, const enum C8LogLevels i_level, const C8Char *i_err_text, ... ); FIX_ADAPTER_EXPORT void C8FIXLogWarning(C8Int i_err_code, const C8Char *i_err_text_id, ...); FIX_ADAPTER_EXPORT void C8FIXLogError(C8Int i_err_code, const C8Char *i_err_text_id, ...);
The Connection plug-in can invoke functions provided by the out-of-process CEP C SDK. When doing so, there is no need to call C8ClientSDKInitialize() and C8ClientSDKShutdown() functions as these have already been called by the FIX Adapter.
<preference name="LibraryName">c8_adapters_fix_plugins_lib</preference> <preference name="InitializeFunction">c8FixQuickfixPluginInitialize</preference> <preference name="SendMessageFunction">c8FixQuickfixPluginSendMessage</preference> <preference name="ShutdownFunction">c8FixQuickfixPluginShutdown</preference>
g++ -I${HOME}/sybasec8/server/sdk/c/include \ -o libcustomized_fix_app_lib.so \ -L${HOME}/sybasec8/server/sdk/c/lib/ \ -lc8_adapters_fix_lib -lc8_sdk_server_lib -lnspr4 -lplc4 \ -llibxml2 -fPIC -shared customized_fix_app.cpp
<section name="ConnectionPlugin"> <preference name="LibraryName">customized_fix_app_lib</preference>Finally, ensure that the new shared library is placed in a directory that is in the LD_LIBRARY_PATH.