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 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

      public void addWorkContainer(WorkContainer<K,V> wc)
    • onSuccess

      public void onSuccess(WorkContainer<?,?> wc)
    • onFailure

      public void onFailure(WorkContainer<?,?> wc)
      Idempotent - work may have not been removed, either way it's put back
    • getLowestRetryTime

      public Optional<Duration> getLowestRetryTime()
      Returns:
      none if there are no messages to retry
    • getWorkIfAvailable

      public List<WorkContainer<K,V>> getWorkIfAvailable(int requestedMaxWorkToRetrieve)
    • getOptions

      public ParallelConsumerOptions getOptions()