Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

SQS Consumer

A simple SQS consumer with backoff strategy for failure processing.

Example Usage

int numListenerThreads = 5;
ExecutorService executorService = Executors.newFixedThreadPool(numListenerThreads);
AmazonSQS sqs = AmazonSQSClientBuilder.defaultClient();

for (int i = 0; i < numListenerThreads; ++i) {
    executorService.submit(SQSConsumer.builder()
        .withMaxNumberOfMessages(10)
        .withSqs(sqs)
        .withMessageProcessor(m -> System.out.println("received message: " + m))
        .withBackOff(new SQSMessageWaitTimeFunction(
            new ExponentialBackoffStrategy(),
            Duration.ofMinutes(1), // initial wait time
            Duration.ofHours(1) // maximum wait time for a message across all retries
        ))
        .withQueueURL(sqs.getQueueUrl("TestQueue").getQueueUrl())
        .build()
    );
}

About

A simple SQS consumer with backoff strategy for failure processing.

Resources

License

Releases

No releases published

Packages

No packages published

Languages