Closed s0umyadeep closed 1 year ago
Unfortunately the current implementation does not allow you to disable prefetching entirely. Marking as a requested feature.
Perhaps I'm misreading the code, but hasn't this indeed been fixed?
In the current version 1.0.6 I would think it can be solved like this:
SQSConnectionFactory connectionFactory = new SQSConnectionFactory(
new ProviderConfiguration().withNumberOfMessagesToPrefetch(0), // Turn off prefetching
AmazonSQSClientBuilder.standard()
.withRegion(awsRegion)
.withCredentials(new DefaultAWSCredentialsProviderChain()));
Or am I wrong?
The SQS JMS implementation always prefetches at least one message before it invokes message listener. This prevents EC2 from autoscaling based on the number of messages in the SQS queue especially when execution of the message takes as long as 2 hours. Is there anyway we can optionally prefetch or do not prefetch at all? Unless I am missing something, there is no way I could extend the behavior of SQSMessageConsumerPrefetch class to make it usable for us. It will be nice if the prefetch is made optional.