Class TailProxyReader


public class TailProxyReader extends ProxyReader
Keeps the most recent n records in an in-memory RecordList which can be retrieved asynchronously while data is flowing through.
  • Constructor Details

    • TailProxyReader

      public TailProxyReader(DataReader nestedDataReader, int maxRecords)
      Creates a reader that keeps the last maxRecords records read through it; a negative count is rejected.
  • Method Details

    • getMaxRecords

      public int getMaxRecords()
    • getSnapshot

      public RecordList getSnapshot()
      Returns a new list of the most recent records (the same instances, not copies); safe to call while records flow.
    • 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
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Description copied from class: Endpoint
      Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.
      Overrides:
      addExceptionProperties in class ProxyReader