The String codec IAF plug-in
The StringCodec/JStringCodec codec plug-ins read transport events as simple text strings and breaks them into fields, names and values, using delimiter strings supplied by configuration properties.
Events are assumed to have the following general format:
<name1><sepA><value1><sepB><name2><sepA><value2><sepB>
...
<namen><sepA><valuen><terminator>
where <name> corresponds to the field name, followed by a delimiter character or string <sepA>, followed by the field's value, <value>. The complete <name> and <value> pair is then separated from another such sequence by a <sepB> delimiter. This pattern is assumed to repeat itself.
Fields with empty values are permitted. Because the terminator is optional, the codec will consume names and values up to the end of the input string if no terminator is found.
In order to load this plug-in, the <codecs> element in the adapter's configuration file must load the StringCodec library (this represents the filename of the library that implements the plug-in). Note that for the Java version, the full path to the plug-in's .jar file must be specified.
A configuration file for C/C++ would use this:
<codec name="StringCodec" library="StringCodec">
In a configuration file for Java:
<codec name="JStringCodec"
jarName="Apama_install_dir\lib\JFileAdapter.jar"
className="com.apama.iaf.codec.string.JStringCodec">
The String codec plug-in takes the following properties:
NameValueSeparator — The string used to separate names and values (
<sepA> above).
FieldSeparator — The string used to separate fields (
<sepB> above).
Terminator — The string used to mark the end of the event string.
All properties must be specified in the adapter configuration file.
For more information on specifying plug-ins in an adapter's configuration file, see
Transport and codec plug-in configuration.
This is one of the sample plug-ins for which source code is available – see the
IAF samples for more information.