public class SQSTaskQueue extends Object implements TaskQueue
Modifier and Type | Class and Description |
---|---|
static class |
SQSTaskQueue.MsgProp |
Constructor and Description |
---|
SQSTaskQueue(com.amazonaws.services.sqs.AmazonSQSClient sqsClient,
String queueName) |
SQSTaskQueue(String queueName)
Creates a SQSTaskQueue that serves as a handle to interacting with a remote
Amazon SQS Queue.
|
Modifier and Type | Method and Description |
---|---|
void |
deleteTask(Task task)
Deletes a task from the queue.
|
void |
deleteTasks(Set<Task> tasks)
Deletes a set of tasks
|
void |
extendVisibilityTimeout(Task task)
Responsible for robustly extending the visibility timeout of a Task.
|
String |
getName()
A name identifying the queue used for logging and analysis purposes.
|
protected Task |
marshallTask(com.amazonaws.services.sqs.model.Message msg) |
void |
put(Set<Task> tasks)
Puts multiple tasks on the queue using batch puts.
|
void |
put(Task... tasks)
Convenience method that calls put(Set
|
void |
put(Task task)
puts a task on the queue
|
void |
requeue(Task task)
Requeues the task by deleting the task, incrementing the "attempts"
counter, and re-adding back to the queue.
|
Integer |
size() |
Integer |
sizeIncludingInvisibleAndDelayed() |
Task |
take()
Blocks until a task is available
|
Set<Task> |
take(int maxTasks)
Take a max of specified number of tasks.
|
protected String |
unmarshallTask(Task task) |
public SQSTaskQueue(String queueName)
public SQSTaskQueue(com.amazonaws.services.sqs.AmazonSQSClient sqsClient, String queueName)
public String getName()
TaskQueue
protected Task marshallTask(com.amazonaws.services.sqs.model.Message msg)
public void put(Task task)
TaskQueue
public void put(Task... tasks)
public void put(Set<Task> tasks)
public Set<Task> take(int maxTasks) throws TimeoutException
TaskQueue
take
in interface TaskQueue
maxTasks
- to take from queue. Must be between 1 and 10 inclusive.TimeoutException
public Task take() throws TimeoutException
TaskQueue
take
in interface TaskQueue
TimeoutException
public void extendVisibilityTimeout(Task task) throws TaskNotFoundException
TaskQueue
extendVisibilityTimeout
in interface TaskQueue
TaskNotFoundException
public void deleteTask(Task task) throws TaskNotFoundException
TaskQueue
deleteTask
in interface TaskQueue
TaskNotFoundException
public void deleteTasks(Set<Task> tasks) throws TaskException
TaskQueue
deleteTasks
in interface TaskQueue
TaskException
public void requeue(Task task)
TaskQueue
public Integer size()
public Integer sizeIncludingInvisibleAndDelayed()
sizeIncludingInvisibleAndDelayed
in interface TaskQueue
Copyright © 2009–2017 DuraSpace. All rights reserved.