Class AsyncRecordPipeLoop

java.lang.Object
com.kingsrook.qqq.backend.core.actions.async.AsyncRecordPipeLoop

public class AsyncRecordPipeLoop extends Object
Class that knows how to Run an asynchronous job (lambda, supplier) that writes into a RecordPipe, with another lambda (consumer) that consumes records from the pipe. Takes care of the job status monitoring, blocking when the pipe is empty, etc.
  • Constructor Details

    • AsyncRecordPipeLoop

      public AsyncRecordPipeLoop()
  • Method Details

    • run

      public int run(String jobName, Integer recordLimit, RecordPipe recordPipe, UnsafeFunction<AsyncJobCallback,? extends Serializable,QException> supplier, UnsafeSupplier<Integer,QException> consumer) throws QException
      Run an async-record-pipe-loop.
      Parameters:
      jobName - name for the async job thread
      recordLimit - optionally, cancel the supplier/job after this number of records. e.g., for a preview step.
      recordPipe - constructed before this call, and used in both of the lambdas
      supplier - lambda that adds records into the pipe. e.g., a query or extract step.
      consumer - lambda that consumes records from the pipe e.g., a transform/load step.
      Throws:
      QException
    • getMinRecordsToConsume

      public Integer getMinRecordsToConsume()
      Getter for minRecordsToConsume
    • setMinRecordsToConsume

      public void setMinRecordsToConsume(Integer minRecordsToConsume)
      Setter for minRecordsToConsume
    • withMinRecordsToConsume

      public AsyncRecordPipeLoop withMinRecordsToConsume(Integer minRecordsToConsume)
      Fluent setter for minRecordsToConsume