Leased Claims
Each attempt gets a random token and an expiring lease. Only the current attempt can complete, fail or renew its job.
Leased claims with ownership tokens, a retry policy stored with every job, deadlines, and a worker daemon on Doctrine DBAL.
use Solo\JobQueue\JobQueue;
use Solo\JobQueue\Codec\ContainerJobCodec;
use Solo\JobQueue\Storage\{DbalJobStorage, Schema};
use Solo\JobQueue\Worker\Worker;
Schema::install($connection);
$queue = new JobQueue(
storage: new DbalJobStorage($connection),
codec: new ContainerJobCodec($container),
);
$queue->push(new SendEmailJob('user@example.com', 'Welcome'), 'email');
// In a long-running process: claim, run and acknowledge one job at a time.
(new Worker($queue, type: 'email'))->run();composer require solophp/job-queueRequirements: PHP 8.3+, ext-mbstring, Doctrine DBAL 4, and MySQL 8+, MariaDB 10.6+, PostgreSQL or SQLite 3.35+