dag-worker / Exports / DlqReinjectService
Class: DlqReinjectService
Reprocesses failed tasks by moving messages from the dead-letter queue back to the main processing queue with an incremented attempt number.
Acquires a lease on the task run before modifying state to prevent concurrent reinject races when DLQ visibility timeout expires.
See
TaskRunStateMachine for retry state transitions
Table of contents
Constructors
Methods
Constructors
constructor
• new DlqReinjectService(storage, deadLetterQueue, mainQueue, lease, clock): DlqReinjectService
Parameters
| Name | Type |
|---|---|
storage | IStoragePort |
deadLetterQueue | IQueuePort |
mainQueue | IQueuePort |
lease | ILeasePort |
clock | IClockPort |
Returns
Defined in
services/dlq-reinject-service.ts:33
Methods
reinjectOnce
▸ reinjectOnce(workerId, visibilityTimeoutMs): Promise<TResult<IDlqReinjectResult, IDagError>>
Dequeues a single message from the dead-letter queue and reinjects it into the main queue for retry processing.
Parameters
| Name | Type | Description |
|---|---|---|
workerId | string | The worker identity for queue visibility and lease ownership. |
visibilityTimeoutMs | number | Visibility timeout for the dequeue operation. |
Returns
Promise<TResult<IDlqReinjectResult, IDagError>>
The reinjection result, or an error if the task run is not found or retry is disallowed.