Interface RecordReaderFactory

All Superinterfaces:
ConfigurableComponent, ControllerService

public interface RecordReaderFactory extends ControllerService

A Controller Service that is responsible for creating a RecordReader.

  • Method Details

    • createRecordReader

      default RecordReader createRecordReader(FlowFile flowFile, InputStream in, ComponentLog logger) throws MalformedRecordException, IOException, SchemaNotFoundException
      Create a RecordReader instance to read records from specified InputStream. This method calls createRecordReader(Map, InputStream, long, ComponentLog) with Attributes of the specified FlowFile.
      Parameters:
      flowFile - Attributes of this FlowFile are used to resolve Record Schema via Expression Language dynamically. This can be null.
      in - InputStream containing Records.
      logger - A logger bound to a component
      Returns:
      Created RecordReader instance
      Throws:
      MalformedRecordException
      IOException
      SchemaNotFoundException
    • createRecordReader

      RecordReader createRecordReader(Map<String,String> variables, InputStream in, long inputLength, ComponentLog logger) throws MalformedRecordException, IOException, SchemaNotFoundException

      Create a RecordReader instance to read records from specified InputStream.

      Many Record Readers will need to read from the Input Stream in order to ascertain the appropriate Schema, and then re-read some of the data in order to read the Records. As a result, it is common for Readers to use mark/reset, so this should be considered when providing an InputStream. The InputStream that is provided by SessionProcess.read / ProcessSession.write does provide the ability to use mark/reset and does so in a way that allows any number of bytes to be read before resetting without requiring that data be buffered. Therefore, it is recommended that when providing an InputStream from ProcessSession that the InputStream not be wrapped in a BufferedInputStream. However, if the stream is coming from elsewhere, it may be necessary.

      Parameters:
      variables - A map containing variables which is used to resolve the Record Schema dynamically via Expression Language. This can be null or empty.
      in - InputStream containing Records.
      inputLength - A hint about the length of the content to read from the InputStream. This value is specified in bytes and a negative value indicates an unknown or unbound size. Some reader implementations must be able to seek to the end of the InputStream and will require knowing the length. Other implementations may be ignore this hint and may read the entire InputStream.
      logger - A logger bound to a component
      Returns:
      Created RecordReader instance
      Throws:
      MalformedRecordException
      IOException
      SchemaNotFoundException