Apama Documentation : Connecting Apama Applications to External Components : Using Standard Adapters : Using Adapter Plug-ins : The CSV codec plug-in
The CSV codec plug-in
 
Multiple configurations and the CSV codec
Decoding CSV data from the sink to send to the correlator
Encoding CSV data from the correlator for the sink
The CSV codec plug-in (JCSVCodec) translates between comma separated value (CSV) data and a sequence of string values. This codec (or the Fixed Width codec plug-in) can be used with the standard Apama File adapter to read data from files and to write data to files. For more information on the Fixed Width codec, see The Fixed Width codec plug-in.
CSV format is a simple way to store data on a value by value basis. Consider an example CSV file that contains stock tick data. The lines in the file are ordered by Symbol, Exchange, Current Price, Day High, and Day Low, as follows:
TSCO, L, 395.50, 401.5, 386.25
MKS, L, 225.25, 240.75, 210.25
In this example, each field is separated from the next by a comma. You can use other characters as separators as long as you identify the separator character for the CSV codec.
To specify a separator character other than a comma, do one of the following:
*Send a configuration event from the transport that is communicating with the CSV codec using the method described in the topic, Multiple configurations and the CSV codec.
*Set the separator property in the IAF configuration file that you use to start the File adapter. For example:
<property name="separator" value=" " />
If you set the separator property, the codec uses the separator you specify by default. If you do not specify the separator property, and the codec does not receive any configuration events before receiving messages to encode or decode, the codec refuses to process messages. The codec throws an exception back to the module that called it, which is either the transport or the semantic mapper depending on whether the data is flowing downstream or upstream.
For an example configuration file, see adapters\config\JCSVCodec-example.xml.dist in the Apama installation directory. The JCSVCodec-example.xml.dist file itself should not be modified, but you can copy relevant sections of the XML code, modify the code as required for the purposes of your data, and then add the modified content to the adapter configuration file in which the codec is to be used.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback