Skip to content

DeadLetterRedriver

Defined in: packages/pipeline-deadletter/src/dead-letter.redriver.ts:90

Redrives dead letters kept by a DeadLetterStore: rebuilds the request, claims the record so that no second redrive runs it at the same time, dispatches it, then marks the record resolved — or, when the handling fails again, counts the attempt, keeps its error, and rethrows it. During a redrive, DeadLetterBehavior neither captures the failure again nor swallows it.

The application supplies the dispatch functions, one per request kind:

const redriver = new DeadLetterRedriver(store, {
  requestTypes: [SendWelcomeEmailCommand, UserCreatedEvent],
  dispatch: {
    command: (command) => commands.execute(command),
    // Only the failed handler, not every subscriber of the event.
    event: (event, record) => eventHandlers[record.handlerName](event),
  },
});
await redriver.redrive(recordId);

new DeadLetterRedriver(store, options): DeadLetterRedriver

Defined in: packages/pipeline-deadletter/src/dead-letter.redriver.ts:93

DeadLetterStore

DeadLetterRedriverOptions

DeadLetterRedriver

redrive(id): Promise<DeadLetterRedriveResult>

Defined in: packages/pipeline-deadletter/src/dead-letter.redriver.ts:108

Redrives the dead letter id.

string

Promise<DeadLetterRedriveResult>

DeadLetterRedriveError when it cannot be redriven; nothing is dispatched.

The handling error when the redrive fails; the attempt is counted. When the store cannot count it, the logger gets the store error and the claim holds until leaseMs ends.


resolve(id): Promise<void>

Defined in: packages/pipeline-deadletter/src/dead-letter.redriver.ts:192

Closes the dead letter id without replaying it.

string

Promise<void>