You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the QueueConsumer receives a self::REJECT and calls $consumer->reject($message, false); on the SqsConsumer the message is deleted. This doesn't allow for the SQS Queue to force it's Dead Letter Maximum Receives, as the message is deleted.
Shouldn't there be a way to reject a message but leave it in SQS so the next iteration of QueueConsumer->consume() will pull the same message and it's received count will rise and eventually hit the Maximum Receives?
Shouldn't there be a way to reject a message but leave it in SQS so the next iteration of QueueConsumer->consume() will pull the same message and it's received count will rise and eventually hit the Maximum Receives?
I am not aware of such feature. Could you please post a link or code example (maybe with SQS SDK) on how to do that?
Use Redrive Policy: Send messages into a dead letter queue after exceeding the Maximum Receives.
In enqueue\sqs\SqsConsumer.php line 133+. No matter what the SqsConsumer receives it always calls $this->context->getClient()->deleteMessage(). Because a message is always deleted the message will never have a received count > 1. If the SQS Queue has a Redrive Policy and a Dead Letter Queue set (which requires that a message's received count is > 'Maximum Receives') the SQS Queue will never send the message to the Dead Letter Queue due to the deletions.
One would need to read the attributes of the Queue and determine if it has a Redrive policy. Somewhat like the 'Example SQS Get Queue Attributes Function' below (This was quickly pasted together so it may not be a 100% accurate solution for enqueue):
If SqsConsumer was aware of the Redrive Policy, there should be a way to force delete the message, do nothing or for SqsConsumer to understand and be configure to be "Redrive Aware" and to "do stuff" with it.
I think it will work for exceptions when nothing is changed back to SQS server, the counter is incremented and the message returned back to the queue and up to max. then moved to a dead letter queue.
When you explicitly reject a message it should not be moved to dead letter queue IMO.
@bendavies any exception, the idea that the reject method is not called, the connection is closed, sqs keeps a message till visibility timeout and returns message back to queue (incrementing the counter).
Activity
makasim commentedon Aug 13, 2018
I am not aware of such feature. Could you please post a link or code example (maybe with SQS SDK) on how to do that?
w3evolutions commentedon Aug 13, 2018
Example SQS Queue Configuration
Use Redrive Policy: Send messages into a dead letter queue after exceeding the Maximum Receives.
In enqueue\sqs\SqsConsumer.php line 133+. No matter what the SqsConsumer receives it always calls
$this->context->getClient()->deleteMessage(). Because a message is always deleted the message will never have a received count > 1. If the SQS Queue has a Redrive Policy and a Dead Letter Queue set (which requires that a message's received count is > 'Maximum Receives') the SQS Queue will never send the message to the Dead Letter Queue due to the deletions.One would need to read the attributes of the Queue and determine if it has a Redrive policy. Somewhat like the 'Example SQS Get Queue Attributes Function' below (This was quickly pasted together so it may not be a 100% accurate solution for enqueue):
My current composer.json
Example SQS Get Queue Attributes Function
enqueue\sqs\SqsConsumer.php
Example of current SqsConsumer.php less the doc blocks.
If SqsConsumer was aware of the Redrive Policy, there should be a way to force delete the message, do nothing or for SqsConsumer to understand and be configure to be "Redrive Aware" and to "do stuff" with it.
makasim commentedon Aug 14, 2018
I think it will work for exceptions when nothing is changed back to SQS server, the counter is incremented and the message returned back to the queue and up to max. then moved to a dead letter queue.
When you explicitly reject a message it should not be moved to dead letter queue IMO.
[-][sqs] Dead Letter Queue Issue[/-][+][sqs] Dead Letter Queue Adoption[/+]bendavies commentedon Sep 11, 2018
We've experienced this issue too.
@makasim is there a specific exception you are referring to?
makasim commentedon Sep 11, 2018
@bendavies any exception, the idea that the reject method is not called, the connection is closed, sqs keeps a message till visibility timeout and returns message back to queue (incrementing the counter).
I've not tested it, but it should be that way