Class WakeupTrigger

java.lang.Object
org.apache.kafka.clients.consumer.internals.WakeupTrigger

public class WakeupTrigger extends Object
Ensures blocking APIs can be woken up by the consumer.wakeup().
  • Constructor Details

    • WakeupTrigger

      public WakeupTrigger()
  • Method Details

    • wakeup

      public void wakeup()
      Wakeup a pending task. If there isn't any pending task, return a WakeupFuture, so that the subsequent call would know wakeup was previously called.

      If there are active tasks, complete it with WakeupException, then unset pending task (return null here. If the current task has already been woken-up, do nothing.

    • setActiveTask

      public <T> CompletableFuture<T> setActiveTask(CompletableFuture<T> currentTask)
      If there is no pending task, set the pending task active. If wakeup was called before setting an active task, the current task will complete exceptionally with WakeupException right away. if there is an active task, throw exception.
      Type Parameters:
      T -
      Parameters:
      currentTask -
      Returns:
    • setFetchAction

      public void setFetchAction(FetchBuffer fetchBuffer)
    • clearTask

      public void clearTask()
    • maybeTriggerWakeup

      public void maybeTriggerWakeup()