Package org.duracloud.common.queue
Interface TaskQueue
- All Known Implementing Classes:
LocalTaskQueue,NoopTaskQueue,RabbitmqTaskQueue,SQSTaskQueue
public interface TaskQueue
- Author:
- Daniel Bernstein
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteTask(Task task) Deletes a task from the queue.voiddeleteTasks(Set<Task> tasks) Deletes a set of tasksvoidextendVisibilityTimeout(Task task) Responsible for robustly extending the visibility timeout of a Task.getName()A name identifying the queue used for logging and analysis purposes.voidputs multiple tasks on the queue using batch puts if the queue implementation supports batch putsvoidputs a task on the queuevoidputs multiple tasks on the queue using batch puts if the queue implementation supports batch putsvoidRequeues the task by deleting the task, incrementing the "attempts" counter, and re-adding back to the queue.size()take()Blocks until a task is availabletake(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
puts a task on the queue- Parameters:
task-
-
put
puts multiple tasks on the queue using batch puts if the queue implementation supports batch puts- Parameters:
tasks-
-
put
puts multiple tasks on the queue using batch puts if the queue implementation supports batch puts- Parameters:
tasks-
-
take
Blocks until a task is available- Returns:
- Throws:
TimeoutException
-
take
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
Responsible for robustly extending the visibility timeout of a Task.- Parameters:
task-- Throws:
TaskNotFoundException
-
deleteTask
Deletes a task from the queue.- Parameters:
task-- Throws:
TaskNotFoundException
-
deleteTasks
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
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-
-