Class ShardManager<K,V>
java.lang.Object
io.confluent.parallelconsumer.state.ShardManager<K,V>
public class ShardManager<K,V> extends Object
Shards are local queues of work to be processed.
Generally they are keyed by one of the corresponding ParallelConsumerOptions.ProcessingOrder modes - key, partition etc...
This state is shared between the BrokerPollSystem thread (write - adding and removing shards and work) and
the AbstractParallelEoSStreamProcessor Controller thread (read - how many records are in the shards?), so
must be thread safe.
-
Constructor Summary
Constructors Constructor Description ShardManager(ParallelConsumerOptions options, WorkManager<K,V> wm, Clock clock) -
Method Summary
Modifier and Type Method Description voidaddWorkContainer(WorkContainer<K,V> wc)Optional<Duration>getLowestRetryTime()longgetNumberOfWorkQueuedInShardsAwaitingSelection()ParallelConsumerOptionsgetOptions()List<WorkContainer<K,V>>getWorkIfAvailable(int requestedMaxWorkToRetrieve)voidonFailure(WorkContainer<?,?> wc)Idempotent - work may have not been removed, either way it's put backvoidonSuccess(WorkContainer<?,?> wc)booleanworkIsWaitingToBeProcessed()
-
Constructor Details
-
Method Details
-
getNumberOfWorkQueuedInShardsAwaitingSelection
public long getNumberOfWorkQueuedInShardsAwaitingSelection()- Returns:
- Work ready in the processing shards, awaiting selection as work to do
-
workIsWaitingToBeProcessed
public boolean workIsWaitingToBeProcessed() -
addWorkContainer
-
onSuccess
-
onFailure
Idempotent - work may have not been removed, either way it's put back -
getLowestRetryTime
- Returns:
- none if there are no messages to retry
-
getWorkIfAvailable
-
getOptions
-