Apama 10.3.1 | Apama Documentation | Connecting Apama Applications to External Components | Standard IAF Plug-ins | Codec IAF Plug-ins | The String codec IAF plug-in
 
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.

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.