Class CSVEmitter

  • All Implemented Interfaces:
    DataEmitter

    public class CSVEmitter
    extends Module
    implements DataEmitter
    A module that emits data contained in a CSV file as a series of maps, each instance containing a row of data. The first row of data is assumed to contain the column names. Each Map instance has the column name as the key and the value in the column as data. Each map instance has as many entries as the number of header columns. Rows that do not have any value for a column have an empty string value in the emitted map.

    All the keys and values in the map are of type string.

    The module accepts request parameters of following types:

    • String : interpreted as a URL, if that fails, a file path from which the csv file can be read. If the string starts with 'r:', it's stripped from the string and rows are emitted in the reverse order of their appearance.
    • File: path to the csv file.
    • URL: the url of the csv file.

    Module Features

    Describes the module attributes
    CapabilitiesData Emitter
    DataFlow Request ParametersString, File or URL. Usage explained above.
    Stops data flowsYes, if there's no more data to emit or if there was an error reading data from the file/URL.
    Start OperationInitializes the thread pool for emitting data.
    Stop OperationShuts down the thread pool.
    Management Interfacenone
    FactoryCSVEmitterFactory
    Author:
    anshul@marketcetera.com