State machine — one SQS message, at-least-once delivery and the DLQ
State machine for a single Amazon SQS standard-queue message showing available, in flight, deleted, expired and moved-to-dead-letter-queue, with the visibility timeout, the ChangeMessageVisibility heartbeat, the four-day retention period and the maxReceiveCount guard that decides redelivery versus redrive.
Make it your own.
title "SQS standard queue — one message, maxReceiveCount 5"
state Available label "available"
state InFlight label "in flight"
state Deleted label "deleted" final
state DeadLetter label "in orders-dlq" final
state Expired label "expired" final
initial Available
transition Available -> InFlight on "ReceiveMessage" [count < 5]
transition Available -> DeadLetter on "ReceiveMessage" [count = 5]
transition Available -> Expired on "retention 4 days elapse"
transition InFlight -> Deleted on "DeleteMessage"
transition InFlight -> Available on "visibility timeout 30 s"
transition InFlight -> Available on "ChangeMessageVisibility 0"
transition InFlight -> InFlight on "ChangeMessageVisibility 300"