spring-cloud-aws
spring-cloud-aws copied to clipboard
Spring Cloud SQS - SQSListener becoming stale
I am using Spring Cloud SQS( spring-cloud-starter-aws-messaging ) in my application
My listener method is annotated as below. But i see that sometimes, the listener is becoming stale or stopped consuming messages from the SQS. I don't see any errors in the logs, and i don't know why this is happening
This is very much a problem as the messages getting queued and we end-up with huge backlog
Please advise how this can be addressed
@SqsListener(value="MessageQueue", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS) public void getMessage(String message) throws MessagingException { super.getMessage(message); }
Could you turn on WARN log levels on org.springframework.cloud.aws.messaging.listener and see if there is anything logged?
Hi sure, this has happened twice in last 2 months. We have to restart the process to start consuming again. i will enable the logging and see, i couldn't reproduce in lower environment
I've seen something similar happening. We never saw anything out of the extraordinary in the logs and never got to investigate this properly as it happened sporadically.
I have enabled WARN but don't see much in the logs. Probably when the issue happens again we may see something. You are right it is happening sporadically.
Any other suggestions or ideas for how to investigate this problem ?
At the moment I can only say that we are aware that SQS listener has many issues and it is going to be rewritten in 3.0.
As a workaround you can add health listener (something similar to what's implemented here https://github.com/spring-cloud/spring-cloud-aws/pull/342) and just let whatever controls your services restart the application when listener becomes unhealthy.
In my experience, this can happen when the core/max pool size on the ThreadPoolTaskExecutor is too low, especially if you're listening to many queues and only one or two stop working.