AWS SQS and Spring pollTimeoutSeconds difference - Stack Overflow

admin2025-04-17  2

I hava been reading about using pollTimeoutSeconds in @SqsListener from Spring Cloud AWS.

Look at this configuration:

@SqsListener(value = "my-queue", pollTimeoutSeconds = "10", maxMessagesPerPoll = "1", maxConcurrentMessages = "1")

Reading the documentation I understood that: If a message arrives within 10 seconds, it's immediately processed. I did the test and confirmed this.

I understood that for every 10 seconds, a new pool will be started again. I could see that on CloudWatch Graphic.

The only difference is that using 1s a request will be fired every 1s, with 10s the request will wait for 10s. (more requests, more costs)

My question is: in terms of receiving messages there is no difference between 10 or 1 second, messages will always be processed immediately when they become visible in SQS, is that correct?

I hava been reading about using pollTimeoutSeconds in @SqsListener from Spring Cloud AWS.

Look at this configuration:

@SqsListener(value = "my-queue", pollTimeoutSeconds = "10", maxMessagesPerPoll = "1", maxConcurrentMessages = "1")

Reading the documentation I understood that: If a message arrives within 10 seconds, it's immediately processed. I did the test and confirmed this.

I understood that for every 10 seconds, a new pool will be started again. I could see that on CloudWatch Graphic.

The only difference is that using 1s a request will be fired every 1s, with 10s the request will wait for 10s. (more requests, more costs)

My question is: in terms of receiving messages there is no difference between 10 or 1 second, messages will always be processed immediately when they become visible in SQS, is that correct?

Share edited Jan 31 at 14:12 spencergibb 25.2k7 gold badges73 silver badges76 bronze badges asked Jan 31 at 13:11 javaTryjavaTry 1,3333 gold badges20 silver badges35 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

messages will always be processed immediately when they become visible in SQS, is that correct?

Immediately is a strong word, but for simplicity, I would say yes.

If a client has started polling and a message enters the queue, SQS will send a response back to client with this message. pollTimeoutSeconds does not affect response time. If a message is available, the call returns sooner than pollTimeoutSeconds

pollTimeoutSeconds is a same thing as WaitTimeSeconds parameter of ReceiveMessage request. About them you could read here: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html

转载请注明原文地址:http://anycun.com/QandA/1744860912a88648.html