Class ReceiveQueueBuffer
- java.lang.Object
-
- com.amazonaws.services.sqs.buffered.ReceiveQueueBuffer
-
public class ReceiveQueueBuffer extends Object
The ReceiveQueueBuffer class is responsible for dequeueing of messages from a single SQS queue. It uses the provided executor to pre-fetch messages from the server and keeps them in a buffer which it uses to satisfy incoming requests. The number of requests pre-fetched and kept in the buffer, as well as the maximum number of threads used to retrieve the messages are configurable.Synchronization strategy: - Threads must hold the TaskSpawnSyncPoint object monitor to spawn a new task or modify the number of inflight tasks - Threads must hold the monitor of the "futures" list to modify the list - Threads must hold the monitor of the "finishedTasks" list to modify the list - If you need to lock both futures and finishedTasks, lock futures first and finishedTasks second
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears and nacks any pre-fetched messages in this buffer.com.amazonaws.services.sqs.buffered.QueueBufferFuture<ReceiveMessageRequest,ReceiveMessageResult>
receiveMessageAsync(ReceiveMessageRequest rq, com.amazonaws.services.sqs.buffered.QueueBufferCallback<ReceiveMessageRequest,ReceiveMessageResult> callback)
Submits the request for retrieval of messages from the queue and returns a future that will be signalled when the request is satisfied.void
shutdown()
Prevents spawning of new retrieval batches and waits for all in-flight retrieval batches to finish
-
-
-
Method Detail
-
shutdown
public void shutdown()
Prevents spawning of new retrieval batches and waits for all in-flight retrieval batches to finish
-
receiveMessageAsync
public com.amazonaws.services.sqs.buffered.QueueBufferFuture<ReceiveMessageRequest,ReceiveMessageResult> receiveMessageAsync(ReceiveMessageRequest rq, com.amazonaws.services.sqs.buffered.QueueBufferCallback<ReceiveMessageRequest,ReceiveMessageResult> callback)
Submits the request for retrieval of messages from the queue and returns a future that will be signalled when the request is satisfied. The future may already be signalled by the time it is returned.- Returns:
- never null
-
clear
public void clear()
Clears and nacks any pre-fetched messages in this buffer.
-
-