Interface TaskQueue

All Known Implementing Classes:
LocalTaskQueue, NoopTaskQueue, RabbitmqTaskQueue, SQSTaskQueue

public interface TaskQueue
Author:
Daniel Bernstein
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deletes a task from the queue.
    void
    Deletes a set of tasks
    void
    Responsible for robustly extending the visibility timeout of a Task.
    A name identifying the queue used for logging and analysis purposes.
    void
    put(Set<Task> tasks)
    puts multiple tasks on the queue using batch puts if the queue implementation supports batch puts
    void
    put(Task task)
    puts a task on the queue
    void
    put(Task... tasks)
    puts multiple tasks on the queue using batch puts if the queue implementation supports batch puts
    void
    requeue(Task task)
    Requeues the task by deleting the task, incrementing the "attempts" counter, and re-adding back to the queue.
     
     
    Blocks until a task is available
    take(int maxTasks)
    Take a max of specified number of tasks.
  • Method Details

    • getName

      String getName()
      A name identifying the queue used for logging and analysis purposes.
      Returns:
    • put

      void put(Task task)
      puts a task on the queue
      Parameters:
      task -
    • put

      void put(Task... tasks)
      puts multiple tasks on the queue using batch puts if the queue implementation supports batch puts
      Parameters:
      tasks -
    • put

      void put(Set<Task> tasks)
      puts multiple tasks on the queue using batch puts if the queue implementation supports batch puts
      Parameters:
      tasks -
    • take

      Task take() throws TimeoutException
      Blocks until a task is available
      Returns:
      Throws:
      TimeoutException
    • take

      Set<Task> take(int maxTasks) throws TimeoutException
      Take a max of specified number of tasks. Blocks until at least one task is available.
      Parameters:
      maxTasks - to take from queue. Must be between 1 and 10 inclusive.
      Returns:
      Throws:
      TimeoutException
    • extendVisibilityTimeout

      void extendVisibilityTimeout(Task task) throws TaskNotFoundException
      Responsible for robustly extending the visibility timeout of a Task.
      Parameters:
      task -
      Throws:
      TaskNotFoundException
    • deleteTask

      void deleteTask(Task task) throws TaskNotFoundException
      Deletes a task from the queue.
      Parameters:
      task -
      Throws:
      TaskNotFoundException
    • deleteTasks

      void deleteTasks(Set<Task> tasks) throws TaskException
      Deletes a set of tasks
      Parameters:
      tasks -
      Throws:
      TaskException
    • size

      Integer size()
      Returns:
      The approximate number of elements in this queue (does not include invisible and delayed tasks).
    • sizeIncludingInvisibleAndDelayed

      Integer sizeIncludingInvisibleAndDelayed()
      Returns:
      The approximate number of elements in this queue including all items that are visible (available for takes), invisible (in process - not yet completed), and delayed (pending addition to the queue).
    • requeue

      void requeue(Task task)
      Requeues the task by deleting the task, incrementing the "attempts" counter, and re-adding back to the queue. Any subsequent calls on the requeued task via the task queue should fail due to the task not being found.
      Parameters:
      task -