Messaging

Retry and dead-letter policy

Retry policies handle temporary failures without overwhelming a service. A dead-letter or failed-job store retains jobs that cannot safely progress automatically. A scheduler decides when a job becomes eligible; actual execution can occur later because workers are busy or unavailable. Do not retry every failure forever. Do not redrive a failed job without considering its previous effects. A scheduled time is not a guarantee of exact execution time. Source: https://docs.bullmq.io/guide/retrying-failing-jobs Local examples do not establish third-party integration support.

Formal Syntax & Structure

nodejs syntaxnodejs
attempts: maximum total attempts; backoff: delay strategy (BullMQ options)

Working Example

Example Snippetnodejs
function retry({attempt,transient}) {  if(!transient||attempt>=3)return null;  return 250*2**(attempt-1);}for(const state of [{attempt:1,transient:true},{attempt:2,transient:true},{attempt:3,transient:true},{attempt:1,transient:false}])console.log(retry(state));
Node.js Reference