Skip to content
Advertisement

AWS SQS – MessageConsumer stops to receive messages after a while

My application registers a listeners to a SQS queue (queue itself is populated by a SNS topic). When I start the application, message consumer is working as expected but after a while it stops to receive any messages. Can it be that consumer is shutting down after a while?

Suggestions or comments would be much appreciated.

SQSConnection:

JavaScript

Consummer:

JavaScript

Advertisement

Answer

You’re trying to manage the connection lifecycle by yourself.

I recommend you to let spring manage that for you, by using spring-cloud-aws

https://docs.spring.io/spring-cloud-aws/docs/2.2.3.RELEASE/reference/html/#receiving-a-message

You can create a listener through annotations:

JavaScript
Advertisement