Package io.datarouter.conveyor.queue
Class BaseBatchedQueueConsumerConveyor<PK extends io.datarouter.model.key.primary.PrimaryKey<PK>,D extends io.datarouter.model.databean.Databean<PK,D>>
java.lang.Object
io.datarouter.conveyor.BaseConveyor
io.datarouter.conveyor.queue.BaseBatchedQueueConsumerConveyor<PK,D>
public abstract class BaseBatchedQueueConsumerConveyor<PK extends io.datarouter.model.key.primary.PrimaryKey<PK>,D extends io.datarouter.model.databean.Databean<PK,D>> extends BaseConveyor
Drains the queue and stores the data in a buffer. When the buffer hits a set limit it will trigger the processing as
a batch. This implementation makes the best effort to process the buffer if the queue gets drained or it has been
interrupted.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.datarouter.conveyor.BaseConveyor
BaseConveyor.ProcessBatchResult -
Field Summary
-
Constructor Summary
Constructors Constructor Description BaseBatchedQueueConsumerConveyor(java.lang.String name, java.util.function.Supplier<java.lang.Boolean> shouldRun, BatchedQueueConsumer<PK,D> queueConsumer, io.datarouter.web.exception.ExceptionRecorder exceptionRecorder) -
Method Summary
Modifier and Type Method Description voidinterrupted()BaseConveyor.ProcessBatchResultprocessBatch()protected abstract voidprocessBuffer(java.util.List<D> databeans)
-
Constructor Details
-
BaseBatchedQueueConsumerConveyor
public BaseBatchedQueueConsumerConveyor(java.lang.String name, java.util.function.Supplier<java.lang.Boolean> shouldRun, BatchedQueueConsumer<PK,D> queueConsumer, io.datarouter.web.exception.ExceptionRecorder exceptionRecorder)
-
-
Method Details
-
processBatch
- Specified by:
processBatchin classBaseConveyor
-
interrupted
public void interrupted() throws java.lang.Exception- Overrides:
interruptedin classBaseConveyor- Throws:
java.lang.Exception
-
processBuffer
-