SafeQueue
SafeQueue copied to clipboard
How to use SafeQueue with Laravel Horizon?
Can I use this package with Laravel Horizon?
How to start doctrine:queue:work
using Laravel Horizon (Laravel 5.5 or 5.6)?
I personally replaced the horizon:work
command with the following:
<?php declare(strict_types=1);
namespace App\Console\Commands;
use Laravel\Horizon\Console\WorkCommand;
use MaxBrokman\SafeQueue\Worker;
class HorizonSafeQueueWorkCommand extends WorkCommand
{
/** @var string */
protected $description = 'Start processing jobs on the queue as a daemon in a doctrine-safe way.';
public function __construct(Worker $worker)
{
parent::__construct($worker);
}
}
Just loads the SageQueue worker inside the Horizon queue command
Updated for Laravel 6, for if #24 ever gets merged
<?php
namespace App\Console\Commands;
use MaxBrokman\SafeQueue\Worker;
use Laravel\Horizon\Console\WorkCommand;
use Illuminate\Contracts\Cache\Repository as Cache;
class HorizonSafeQueueWorkCommand extends WorkCommand
{
/**
* @var string
*/
protected $description = 'Start processing jobs on the queue as a daemon in a doctrine-safe way.';
/**
* WorkCommand constructor.
*
* @param Worker $worker
* @param Cache $cache
*/
public function __construct(Worker $worker, Cache $cache)
{
parent::__construct($worker, $cache);
}
}