Class TeeReader


public class TeeReader extends ProxyReader
A proxy reader that also writes every record passing through it to a DataWriter.
  • Constructor Details

    • TeeReader

      public TeeReader(DataReader nestedDataReader, DataWriter writer, boolean cloneRecord)
      Creates a new TeeReader.
      Parameters:
      nestedDataReader - the previous reader in this pipeline.
      writer - the sink to receive records passing through this proxy.
      cloneRecord - Indicates if a copy of the original record should be sent to the writer instead of the original record itself (default false). If the original record is sent to the writer, any changes made by the writer will be seen by subsequent steps in the primary pipeline.
    • TeeReader

      public TeeReader(DataReader nestedDataReader, DataWriter writer)
      Creates a new TeeReader.
      Parameters:
      nestedDataReader - the previous reader in this pipeline.
      writer - the sink to receive records passing through this proxy.
  • Method Details

    • isCloneRecord

      public boolean isCloneRecord()
      Indicates if a copy of the original record should be sent to the writer (default false), otherwise the original record is sent to the writer. If the original record is sent to the writer, any changes made by the writer will be seen by subsequent steps in the primary pipeline.
    • open

      public void open() throws DataException
      Description copied from class: DataEndpoint
      Makes this endpoint ready for reading or writing.
      Overrides:
      open in class ProxyReader
      Throws:
      DataException
    • close

      public void close() throws DataException
      Description copied from class: DataEndpoint
      Indicates that this endpoint has finished reading or writing.
      Overrides:
      close in class ProxyReader
      Throws:
      DataException
    • interceptRecord

      protected Record interceptRecord(Record record) throws Throwable
      Description copied from class: ProxyReader
      Overridden by subclasses to transform, drop, or observe a record on its way through this proxy.

      Contract for subclasses (see also docs/authoring/ProxyReader.md):

      • Return the record (possibly modified) to pass it downstream.
      • Return null to drop the record; the framework reads the next one.
      • Throw to fail the pipeline; the framework wraps the throwable in a DataException with .setRecord(record).
      • The nested DataReader is opened and closed for you; do not read from it here.
      • Do not call DataEndpoint.incrementRecordCount() here.
      Overrides:
      interceptRecord in class ProxyReader
      Throws:
      Throwable