Class SendQueueBuffer
java.lang.Object
com.amazonaws.services.sqs.buffered.SendQueueBuffer
This class is responsible for buffering outgoing SQS requests, i.e. requests to send a message,
delete a message and change the visibility of the message.
When a request arrives, the buffer adds the message to a message batch of an appropriate type (creating such a batch if there currently isn't one outstanding). When the outstanding batch becomes full, or when a configurable timeout expires, the buffer makes a call to SQS to execute the current batch.
Internally, the batch objects maintain a list of futures corresponding to the requests added to them. When a batch completes, it loads the results into the futures and marks the futures as complete.
When a request arrives, the buffer adds the message to a message batch of an appropriate type (creating such a batch if there currently isn't one outstanding). When the outstanding batch becomes full, or when a configurable timeout expires, the buffer makes a call to SQS to execute the current batch.
Internally, the batch objects maintain a list of futures corresponding to the requests added to them. When a batch completes, it loads the results into the futures and marks the futures as complete.
-
Method Summary
Modifier and TypeMethodDescriptioncom.amazonaws.services.sqs.buffered.QueueBufferFuture
<ChangeMessageVisibilityRequest, ChangeMessageVisibilityResult> changeMessageVisibility
(ChangeMessageVisibilityRequest request, com.amazonaws.services.sqs.buffered.QueueBufferCallback<ChangeMessageVisibilityRequest, ChangeMessageVisibilityResult> callback) com.amazonaws.services.sqs.buffered.QueueBufferFuture
<DeleteMessageRequest, DeleteMessageResult> deleteMessage
(DeleteMessageRequest request, com.amazonaws.services.sqs.buffered.QueueBufferCallback<DeleteMessageRequest, DeleteMessageResult> callback) void
flush()
Flushes all outstanding outbound requests (SendMessage
,DeleteMessage
,ChangeMessageVisibility
) in this buffer.com.amazonaws.services.sqs.buffered.QueueBufferFuture
<SendMessageRequest, SendMessageResult> sendMessage
(SendMessageRequest request, com.amazonaws.services.sqs.buffered.QueueBufferCallback<SendMessageRequest, SendMessageResult> callback)
-
Method Details
-
getConfig
-
sendMessage
public com.amazonaws.services.sqs.buffered.QueueBufferFuture<SendMessageRequest,SendMessageResult> sendMessage(SendMessageRequest request, com.amazonaws.services.sqs.buffered.QueueBufferCallback<SendMessageRequest, SendMessageResult> callback) - Returns:
- never null
-
deleteMessage
public com.amazonaws.services.sqs.buffered.QueueBufferFuture<DeleteMessageRequest,DeleteMessageResult> deleteMessage(DeleteMessageRequest request, com.amazonaws.services.sqs.buffered.QueueBufferCallback<DeleteMessageRequest, DeleteMessageResult> callback) - Returns:
- never null
-
changeMessageVisibility
public com.amazonaws.services.sqs.buffered.QueueBufferFuture<ChangeMessageVisibilityRequest,ChangeMessageVisibilityResult> changeMessageVisibility(ChangeMessageVisibilityRequest request, com.amazonaws.services.sqs.buffered.QueueBufferCallback<ChangeMessageVisibilityRequest, ChangeMessageVisibilityResult> callback) - Returns:
- never null
-
flush
public void flush()Flushes all outstanding outbound requests (SendMessage
,DeleteMessage
,ChangeMessageVisibility
) in this buffer.The call returns successfully when all outstanding outbound requests submitted before the call are completed (i.e. processed by SQS).
-