Know When a Queue Message Fails for Good — and Why
When a message on one of your App's queues runs out of retries, Spikefrost now records the reason and can tell your App about it. Turn on the dead-letter notice for an environment and your App's deadLetter function is called once with the queue, the message and the last error, so you can alert, log or compensate instead of finding out later. Until now the only way to see these messages was to look into the dead-letter queue by hand.
Highlights
- The reason for each dead-lettered message is kept for 5 days and shown by sf queues stats and sf queues dlq peek, including messages cut off by the delivery deadline, which never reach your App's own log
- Export one function from your App, deadLetter(dead, env, ctx): it receives the queue name, message id, number of attempts, message body, reason and time
- Switch the notice on or off per environment with sf queues dead-letter on|off or in the web console; it applies within a minute, without a deploy. You can also declare "deadLetter": true at the top level of app/queues.json
- The notice is sent once and is not retried; the message goes to the dead-letter queue either way, and peek shows whether your App was told
- Queue figures in the web console: backlog, oldest message, in flight, retrying and dead-lettered count for each queue
- Deploy your App once to pick up the notice; requires sf CLI 0.9.25. The notice runs in your own App and is metered like any other request to it