Class AsyncRecordPipeLoop
java.lang.Object
com.kingsrook.qqq.backend.core.actions.async.AsyncRecordPipeLoop
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGetter for minRecordsToConsumeint
run
(String jobName, Integer recordLimit, RecordPipe recordPipe, UnsafeFunction<AsyncJobCallback, ? extends Serializable, QException> supplier, UnsafeSupplier<Integer, QException> consumer) Run an async-record-pipe-loop.void
setMinRecordsToConsume
(Integer minRecordsToConsume) Setter for minRecordsToConsumewithMinRecordsToConsume
(Integer minRecordsToConsume) Fluent setter for minRecordsToConsume
-
Constructor Details
-
AsyncRecordPipeLoop
public AsyncRecordPipeLoop()
-
-
Method Details
-
run
public int run(String jobName, Integer recordLimit, RecordPipe recordPipe, UnsafeFunction<AsyncJobCallback, ? extends Serializable, throws QExceptionQException> supplier, UnsafeSupplier<Integer, QException> consumer) Run an async-record-pipe-loop.- Parameters:
jobName
- name for the async job threadrecordLimit
- 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 lambdassupplier
- 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
Getter for minRecordsToConsume -
setMinRecordsToConsume
Setter for minRecordsToConsume -
withMinRecordsToConsume
Fluent setter for minRecordsToConsume
-