Skip to content

DbFailedJobStore

Persistent FailedJobStoreInterface — an inspectable dead-letter table, alternative to the default LogFailedJobStore.

Implements InspectableFailedJobStoreInterface so queue:failed:list/ queue:failed:retry/queue:failed:forget can query it.

Schema (see DbFailedJobStore::schema()): CREATE TABLE quiote_queue_failed_jobs ( id VARCHAR(32) PRIMARY KEY, job_class VARCHAR(255) NOT NULL, params TEXT NOT NULL, exception_class VARCHAR(255) NOT NULL, exception_message TEXT NOT NULL, exception_trace TEXT NOT NULL, attempts INTEGER NOT NULL, failed_at INTEGER NOT NULL );

final readonly class DbFailedJobStore implements InspectableFailedJobStoreInterface

ImplementsInspectableFailedJobStoreInterface
SourceDbFailedJobStore.php

public function __construct(PDO $pdo, string $table = 'quiote_queue_failed_jobs', ClockInterface $clock = new SystemClock(…), RandomnessInterface $randomness = new SystemRandomness(…)): mixed

ParameterTypeDescription
$pdoPDO
$tablestring
$clockClockInterface
$randomnessRandomnessInterface

Returns mixed

MethodDescription
count(): intReturns the total number of rows in the dead-letter table.
delete(string $id): voidDeletes the dead-letter row with this id.
find(string $id): ?FailedJobRecordLoads a single dead-letter record by id, or null when no row matches.
list(int $limit = 50, int $offset = 0): list<FailedJobRecord>
record(FailedJob $failedJob): voidInserts the failure as a new row with a fresh random id.
schema(string $table = 'quiote_queue_failed_jobs'): stringDDL to create the backing table (PostgreSQL / SQLite compatible).

public function count(): int

Returns the total number of rows in the dead-letter table.

Returns int

ThrowsWhen
RuntimeExceptionif the driver refuses the count query, which in practice means the table is missing.

public function delete(string $id): void

Deletes the dead-letter row with this id.

An id with no matching row deletes nothing and reports no error.

ParameterTypeDescription
$idstring

public function find(string $id): ?FailedJobRecord

Loads a single dead-letter record by id, or null when no row matches.

ParameterTypeDescription
$idstring

Returns ?FailedJobRecord

ThrowsWhen
RuntimeExceptionif the matching row has columns of the wrong type for a FailedJobRecord.

public function list(int $limit = 50, int $offset = 0): list<FailedJobRecord>

ParameterTypeDescription
$limitint
$offsetint

Returns list``<FailedJobRecord>

public function record(FailedJob $failedJob): void

Inserts the failure as a new row with a fresh random id.

Params are stored as JSON and the failure time is stamped from the current clock, so a record is never overwritten — repeated failures of the same job class accumulate as separate rows.

ParameterTypeDescription
$failedJobFailedJob
ThrowsWhen
JsonExceptionif the job params cannot be encoded.

public static function schema(string $table = 'quiote_queue_failed_jobs'): string

DDL to create the backing table (PostgreSQL / SQLite compatible).

ParameterTypeDescription
$tablestring

Returns string