Class BaseBatchedLossyQueueConsumerConveyorConfiguration<PK extends io.datarouter.model.key.primary.PrimaryKey<PK>,D extends io.datarouter.model.databean.Databean<PK,D>>
java.lang.Object
io.datarouter.conveyor.queue.configuration.BaseBatchedLossyQueueConsumerConveyorConfiguration<PK,D>
- Type Parameters:
PK- Primary keyD- Databean
- All Implemented Interfaces:
ConveyorConfiguration
public abstract class BaseBatchedLossyQueueConsumerConveyorConfiguration<PK extends io.datarouter.model.key.primary.PrimaryKey<PK>,D extends io.datarouter.model.databean.Databean<PK,D>>
extends Object
implements ConveyorConfiguration
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.
NOTE: If the thread running the conveyor is killed or crashes before the processing of the buffer is
completed the messages are lost forever. Along side the conveyor there must be some backup implementation that
re-queues messages that are lost.
-
Field Summary
Fields inherited from interface io.datarouter.conveyor.ConveyorConfiguration
DEFAULT_PEEK_TIMEOUT, DEFAULT_VISIBILITY_TIMEOUT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intprotected intprotected Durationvoidinterrupted(ConveyorRunnable conveyor) process(ConveyorRunnable conveyor) protected abstract voidprocessBuffer(List<D> databeans) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.datarouter.conveyor.ConveyorConfiguration
compactExceptionLogging, delay, shouldRunOnShutdown
-
Constructor Details
-
BaseBatchedLossyQueueConsumerConveyorConfiguration
public BaseBatchedLossyQueueConsumerConveyorConfiguration()
-
-
Method Details
-
processBuffer
-
getQueueConsumer
-
process
- Specified by:
processin interfaceConveyorConfiguration
-
interrupted
- Specified by:
interruptedin interfaceConveyorConfiguration
-
getMaxQuerySize
protected int getMaxQuerySize() -
getPeekTimeout
-
getBatchSize
protected int getBatchSize()
-