Using many parsers

Sometimes a single parser does not do the job, for example in use cases where the logic needs to read many different file types. You can configure the application to parallel read different file types, too.

About this task

Configure more than one parser and route input files to an appropriate parser to read their contents.

Procedure

  1. In the file <PathToYourApplication>/config/config.cfg, find the ite.ingest.customFileTypeValidator parameter description
  2. When you need to route different file types to different parsers, you make sure that the type validator is turned on as follows: ite.ingest.customFileTypeValidator=on

  3. In the file <PathToYourApplication>/config/config.cfg, find the ite.ingest.reader.parserList parameter description

  4. Assign the parameter file type identifiers that are combined with a parser class name, for example: ite.ingest.reader.parserList=ASN|FileReaderCustomASN1,CSV|FileReaderCustomCSV

Now the application uses a FileTypeValidator to route input files to the correct parser. You must customize the validator and examine the incoming files for their file type. You must write the result to the fileType attribute of the validator’s output tuple. The fileType attribute is then used to route the file to the correct parser. You need to customize the provided FileReaderCustom by using it as blue print to derive your implementation from.