Class SimpleDataImportStreamProcessor

All Implemented Interfaces:
DataImportProcessorBase, ProcessDataLocker

public class SimpleDataImportStreamProcessor extends DataImportStreamProcessor implements ProcessDataLocker
  • Method Details

    • make

      public static SimpleDataImportStreamProcessor make(@NotNull com.fishlib.io.sched.Scheduler scheduler, @NotNull com.fishlib.configuration.Configuration configuration, @NotNull com.fishlib.io.logger.Logger log, @NotNull String description, @NotNull FullTableLocationKey streamKey, @NotNull com.illumon.iris.db.tables.dataimport.logtailer.DataImportStreamProcessor.Directory streamProcessorDirectory, @NotNull LocalTableDataService tableDataService, @NotNull StringCacheProvider stringCacheProvider, @NotNull SchemaService schemaService, @NotNull Runnable closeCallback, @NotNull SimpleDataImportStreamProcessor.OnReject onReject)
      Factory method to create a new SimpleDataImportStreamProcessor
      Parameters:
      scheduler - The scheduler for the flush and commit tasks
      configuration - the configuration to use
      log - The log
      description - description of the data connection
      streamKey - Destination information
      streamProcessorDirectory - An object to lookup Processors based on table key.
      tableDataService - The table data service
      stringCacheProvider - The string cache provider
      schemaService - The schemaService
      closeCallback - callback to be invoked when the simple data stream is closed
      onReject - callback to be invoked if the simple data stream is rejected
      Returns:
      a new SimpleDataImportStreamProcessor
    • processData

      public void processData(@NotNull Runnable runnable)
      Call this with your runnable that processes data and writes to the table to ensure proper locking around the checkpointing and flushing.
      Specified by:
      processData in interface ProcessDataLocker
      Parameters:
      runnable - a runnable that processes data for this stream
    • onInitialization

      protected boolean onInitialization()
    • close

      public void close(@NotNull String reason)
    • checkLiveness

      protected Boolean checkLiveness()
      Description copied from class: DataImportStreamProcessor
      Test "liveness" for this stream processor. checkLiveness will return one of three values:
      • true - the current connection is known to be live - the heartbeat succeeded
      • false - the current connection is dead - the heartbeat attempt threw an exception and the current channel has already been closed, or the liveness check timed out and the connection was killed
      • null - the connection state is unknown - e.g. the heartbeat timed out the connection could not be killed
      Specified by:
      checkLiveness in class DataImportStreamProcessor
      Returns:
      True if alive, false if not, null if uncertain
    • getDescription

      @NotNull protected String getDescription()
    • reject

      protected void reject(@NotNull String reason, @NotNull Exception cause)
    • suspendCheckpointing

      public SafeCloseable suspendCheckpointing()
      Prevent checkpoints from being written until the returned Closeable is closed.

      Note: If you do not close the returned value; then data is never made durable.

      Returns:
      a Closeable object that resumes checkpoint processing.
    • runWhenConsistent

      public void runWhenConsistent(Runnable runnable)
      Wait for the update counter to be consistent, and then run the given function.
      Parameters:
      runnable - the runnable to execute under the processing lock; while the state is consistent