Skip to content

[13.x] Respect SQS redrive policy for native dead letter queue routing#58729

Draft
vimarteleto wants to merge 1 commit intolaravel:masterfrom
vimarteleto:feature/sqs-redrive-policy
Draft

[13.x] Respect SQS redrive policy for native dead letter queue routing#58729
vimarteleto wants to merge 1 commit intolaravel:masterfrom
vimarteleto:feature/sqs-redrive-policy

Conversation

@vimarteleto
Copy link

@vimarteleto vimarteleto commented Feb 10, 2026

When an SQS queue has a redrive policy configured, Laravel currently deletes every message from the queue after processing, including failed jobs. This prevents SQS from ever moving failed messages to the dead letter queue, since deleted messages can't be redriven.

This PR makes the SQS driver aware of the queue's redrive policy so that:

1 - Failed jobs are not deleted from SQS when a redrive policy is configured on AWS, allowing SQS to natively route them to the dead letter queue after maxReceiveCount is exceeded.
2 - maxTries() is derived from maxReceiveCount, aligning Laravels retry mechanism with the SQS redrive policy.

Expected behavior:
Job succeeds, no redrive policy > delete from SQS;
Job succeeds, has redrive policy > delete from SQS;
Job fails, no redrive policy > delete from SQS;
Job fails, has redrive policy > dont delete from SQS, DLQ routing

@vimarteleto vimarteleto reopened this Feb 10, 2026
@vimarteleto vimarteleto marked this pull request as draft February 10, 2026 03:58
@macropay-solutions
Copy link

macropay-solutions commented Feb 10, 2026

Isn't this the same as retrying the failed job from the failed jobs db table? DLQ is for the cases when the job gives fatal more than 3 times (default for SQS) and laravel does not delete it from SQS, nor puts it into failed jobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments