Apama 10.11.3 | Connecting Apama Applications to External Components | Working with IAF Plug-ins | C/C++ Codec Plug-in Development | Getting started with codec layer plug-in development
 
Getting started with codec layer plug-in development
Note:
Before developing a new codec plug-in, it is worth considering whether one of the standard Apama IAF plug-ins could be used instead; see Codec IAF Plug-ins for more information.
In order to facilitate quick development of new codec plug-ins, your distribution includes a codec plug-in skeleton.
This file, called skeleton-codec.c, implements a complete codec plug-in that complies with the Codec Plug-in Development Specification but where the entire custom message format encoding/decoding functionality is missing. The file is located in the samples\iaf_plugin\c\skeleton directory of your installation.
In order to turn the skeleton into a fully operational message format specific codec plug-in, the plug-in author needs to fill in the gaps within the codec generic, decoding and encoding functions; updateProperties, getLastErrorCodec, getStatus, sendNormalisedEvent, flushUpstream, getLastErrorEncoder, addEventTransport, removeEventTransport, sendTransportEvent, setSemanticMapper, flushDownstream, and getLastErrorDecoder. These must implement their specified functionality in the context of the custom message format. The information, constructor and destructor functions are also likely to require adaptation.
The skeleton defines a structure, called EventCodec_Internals, to store all its private data, and this structure is placed within the reserved field of the AP_EventCodec object created within the constructor method. It is likely that this structure will need to be modified to contain additional data that the adapter might require.
The distribution also contains a makefile (for use with GNU Make on UNIX), as well as a workspace file and dsp folder, for use with Microsoft's Visual Studio .NET on Microsoft Windows, for this skeleton, which can be adapted to compile your codec plug-in and link it against any custom libraries required.
Once a plug-in is built, it needs to be placed in a location where it can be picked up by the IAF.
This means that on Windows you either need to copy the .dll into the bin folder, or else place it somewhere which is on your path, that is a location that is referenced by the PATH environment variable.
On UNIX you either need to copy the .so into the lib directory, or else place it somewhere which is on your library path, that is a directory that is referenced by the LD_LIBRARY_PATH environment variable.