Reputation: 544
I'm new using Amazon sqs and I'm supporting some queues in my company. The problem that I'm facing is that a few days ago some messages just got stuck in available messages as you can see in the picture. It's not every message that gets stuck.
Do you guys know what this is about?
Upvotes: 3
Views: 8653
Reputation: 1
In my case, I didn't have EC2 workers available for my queue A
.
You can check that by going to the corresponding cluster.
Elastic Container Services
-> Clusters
-> filter for corresponding cluster A
-> check Pending tasks count
and Running tasks count
metrics
You can wait till the workers become available again. Or spin-up some yourselves.
Upvotes: 0
Reputation: 365
I had a similar problem while reading messages from SQS in a recurrent @Scheduled java job. As John Rotenstein pointed out, the deleteMessage method must be called to remove messages from the queue.
In my case, the problem was on the @Scheduled annotated method itself. For some specific reason, it didn't finished executing under some specific conditions and so the scheduler was never ready to run my reading method again.
Upvotes: 1
Reputation: 269091
It sounds like a worker is failing to correctly process the messages from the queue.
When a worker (or app) retrieves a message from the queue, it needs to call DeleteMessage()
when it has finished processing. This removes it from the queue.
However, it the worker fails, or fails to call DeleteMessage()
, the message will automatically reappear after the invisibility period expires.
You can implement an Amazon SQS dead-letter queue, which will move messages to the dead-letter queue after it has been received a certain number of times. That will move it out of the queue for further examination/processing.
Upvotes: 4