public class SendQueueBuffer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private class |
SendQueueBuffer.ChangeMessageVisibilityBatchTask |
private class |
SendQueueBuffer.DeleteMessageBatchTask |
private static interface |
SendQueueBuffer.Listener<T> |
private class |
SendQueueBuffer.OutboundBatchTask<R extends AmazonWebServiceRequest,Result>
Task to send a batch of outbound requests to SQS.
|
private class |
SendQueueBuffer.SendMessageBatchTask |
Modifier and Type | Field and Description |
---|---|
private java.lang.Object |
changeMessageVisibilityLock
Object used to serialize changeMessageVisibility calls.
|
private QueueBufferConfig |
config
Config settings for this buffer
|
private java.lang.Object |
deleteMessageLock
Object used to serialize deleteMessage calls.
|
private java.util.concurrent.Executor |
executor
The executor service for the batching tasks.
|
private java.util.concurrent.Semaphore |
inflightChangeMessageVisibilityBatches
Permits controlling the number of in flight ChangeMessageVisibility batches.
|
private java.util.concurrent.Semaphore |
inflightDeleteMessageBatches
Permits controlling the number of in flight DeleteMessage batches.
|
private java.util.concurrent.Semaphore |
inflightSendMessageBatches
Permits controlling the number of in flight SendMessage batches.
|
private static org.apache.commons.logging.Log |
log |
private SendQueueBuffer.ChangeMessageVisibilityBatchTask[] |
openChangeMessageVisibilityBatchTask
Current batching task for changeMessageVisibility.
|
private SendQueueBuffer.DeleteMessageBatchTask[] |
openDeleteMessageBatchTask
Current batching task for deleteMessage.
|
private SendQueueBuffer.SendMessageBatchTask[] |
openSendMessageBatchTask
Current batching task for sendMessage.
|
private java.lang.String |
qUrl
Url of our queue
|
private java.lang.Object |
sendMessageLock
Object used to serialize sendMessage calls.
|
private AmazonSQS |
sqsClient
The
AmazonSQS client to use for this buffer's operations. |
Constructor and Description |
---|
SendQueueBuffer(AmazonSQS sqsClient,
java.util.concurrent.Executor executor,
QueueBufferConfig paramConfig,
java.lang.String url) |
private static org.apache.commons.logging.Log log
private final QueueBufferConfig config
private final java.lang.String qUrl
private final AmazonSQS sqsClient
AmazonSQS
client to use for this buffer's operations.private final java.util.concurrent.Executor executor
private final java.lang.Object sendMessageLock
private final java.lang.Object deleteMessageLock
private final java.lang.Object changeMessageVisibilityLock
private final SendQueueBuffer.SendMessageBatchTask[] openSendMessageBatchTask
sendMessageLock
.private final SendQueueBuffer.DeleteMessageBatchTask[] openDeleteMessageBatchTask
deleteMessageLock
.private final SendQueueBuffer.ChangeMessageVisibilityBatchTask[] openChangeMessageVisibilityBatchTask
changeMessageVisibilityLock
.private final java.util.concurrent.Semaphore inflightSendMessageBatches
private final java.util.concurrent.Semaphore inflightDeleteMessageBatches
private final java.util.concurrent.Semaphore inflightChangeMessageVisibilityBatches
SendQueueBuffer(AmazonSQS sqsClient, java.util.concurrent.Executor executor, QueueBufferConfig paramConfig, java.lang.String url)
public QueueBufferConfig getConfig()
public QueueBufferFuture<SendMessageRequest,SendMessageResult> sendMessage(SendMessageRequest request, QueueBufferCallback<SendMessageRequest,SendMessageResult> callback)
public QueueBufferFuture<DeleteMessageRequest,DeleteMessageResult> deleteMessage(DeleteMessageRequest request, QueueBufferCallback<DeleteMessageRequest,DeleteMessageResult> callback)
public QueueBufferFuture<ChangeMessageVisibilityRequest,ChangeMessageVisibilityResult> changeMessageVisibility(ChangeMessageVisibilityRequest request, QueueBufferCallback<ChangeMessageVisibilityRequest,ChangeMessageVisibilityResult> callback)
private <R extends AmazonWebServiceRequest,Result> SendQueueBuffer.OutboundBatchTask<R,Result> newOutboundBatchTask(R request)
OutboundBatchTask
of appropriate type, never nullpublic void flush()
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).
<OBT extends SendQueueBuffer.OutboundBatchTask<R,Result>,R extends AmazonWebServiceRequest,Result> QueueBufferFuture<R,Result> submitOutboundRequest(java.lang.Object operationLock, OBT[] openOutboundBatchTask, R request, java.util.concurrent.Semaphore inflightOperationBatches, QueueBufferCallback<R,Result> callback)
operationLock
- the lock synchronizing calls for the call type ( sendMessage
,
deleteMessage
, changeMessageVisibility
)openOutboundBatchTask
- the open batch task for this call typerequest
- the request to submitinflightOperationBatches
- the permits controlling the batches for this type of requestAmazonClientException
- (see the various outbound calls for details)