I’m using spring-cloud-aws-autoconfigure and spring-cloud-aws-messaging in a Spring Boot application to read messages from an SQS queue.

In the application thread dump, there are 48 threads named pool-3-thread-2pool-3-thread-50 which barely get used. Only 1 of these threads is being used in any given moment in time. When the thread is used, it has the following stack trace:

The stack trace suggests that the threads are reserved for reading from SQS. Since the threads are not being used, I’d like to limit their count to save resources.

How do I configure the number of threads that are being used by the AmazonSQSClient?

I tried creating my own ThreadPoolTaskExecutor as suggested here, but that changed the setting of another pool, not pool-3.

This content was originally published here.