Class DebounceBatchStrategy
java.lang.Object
com.inductiveautomation.eventstream.gateway.stages.batch.BatchStrategy
com.inductiveautomation.eventstream.gateway.stages.batch.DebounceBatchStrategy
Batches until any of the following conditions are met.
1. Debounce timer is hit. Debounce timer is reset every time a new event comes in.
2. Max wait timer is hit. Max wait timer resets on initial event and the first event following a batch forwarding.
3. Shutdown event received. Shutdown event aborts all pending events and then forwards the Shutdown event on a separate thread. A separate thread must be used to ensure the following stages still get the Shutdown event while they're in the middle of forwarding the last batch.
If a debounce timer or max wait timer is hit while the last batch is still being processed, the next batch will be immediately processed upon the previous batch's completion.
Tested are included with
1. Debounce timer is hit. Debounce timer is reset every time a new event comes in.
2. Max wait timer is hit. Max wait timer resets on initial event and the first event following a batch forwarding.
3. Shutdown event received. Shutdown event aborts all pending events and then forwards the Shutdown event on a separate thread. A separate thread must be used to ensure the following stages still get the Shutdown event while they're in the middle of forwarding the last batch.
If a debounce timer or max wait timer is hit while the last batch is still being processed, the next batch will be immediately processed upon the previous batch's completion.
Tested are included with
BatchStage
.-
Nested Class Summary
Nested classes/interfaces inherited from class com.inductiveautomation.eventstream.gateway.stages.batch.BatchStrategy
BatchStrategy.Listener
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDebounceBatchStrategy
(Executor executor, ScheduledExecutorService scheduler, BatchConfig config) -
Method Summary
Methods inherited from class com.inductiveautomation.eventstream.gateway.stages.batch.BatchStrategy
forwardEvents, onBatchReady
-
Field Details
-
unboundedQueue
public final boolean unboundedQueue
-
-
Constructor Details
-
DebounceBatchStrategy
public DebounceBatchStrategy(Executor executor, ScheduledExecutorService scheduler, BatchConfig config)
-
-
Method Details
-
queuedEventCount
public int queuedEventCount()- Specified by:
queuedEventCount
in classBatchStrategy
-
queueSize
public int queueSize()- Specified by:
queueSize
in classBatchStrategy
-
process
- Specified by:
process
in classBatchStrategy
-