Class AmazonSQSBufferedAsyncClient

java.lang.Object
com.amazonaws.services.sqs.buffered.AmazonSQSBufferedAsyncClient
All Implemented Interfaces:
AmazonSQS, AmazonSQSAsync

public class AmazonSQSBufferedAsyncClient extends Object implements AmazonSQSAsync
AmazonSQSBufferedAsyncClient provides client-side batching of outgoing sendMessage, deleteMessage and changeMessageVisibility calls.
After receiving a call, rather than executing it right away, this client waits for a configurable period of time ( default=200ms) for other calls of the same type to come in; if such calls do come in, they are also not executed immediately, but instead are added to the batch. When the batch becomes full or the timeout period expires, the entire batch is executed at once and the results are returned to the callers. This method of operation leads to reduced operating costs (since SQS charges per call and fewer calls are made) and increased overall throughput (since more work is performed per call, and all fixed costs of making a call are amortized over a greater amount of work). The cost of this method is increased latency for individual calls, since calls spend some time waiting on the client side for the potential batch-mates to appear before they are actually executed.
This client also performs pre-fetching of messages from SQS. After the first receiveMessage call is made, the client attempts not only to satisfy that call, but also pre-fetch extra messages to store in a temporary buffer. Future receiveMessage calls will be satisfied from the buffer, and only if the buffer is empty will the calling thread have to wait for the messages to be fetched. The size of the buffer and the maximum number of threads used for prefetching are configurable.
AmazonSQSBufferedAsyncClient is thread-safe.