Skip to content

DefaultQueue

李铭昕 edited this page Sep 18, 2017 · 1 revision

通用消息队列

  1. 完善Job类
namespace App\Jobs;

use App\Jobs\Contract\JobInterface;

class Test implements JobInterface
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

    public function handle()
    {
        echo $this->id . PHP_EOL;
    }

}
  1. 执行通用消息队列
php run Queue
  1. PUSH消息到Redis
use App\Utils\Queue;

Queue::push(new Test(1));
  1. 即可看到消息队列执行结果

  2. 重载所有失败的Job到队列

php run Queue reloadErrorJobs
  1. 清除所有失败的Job
php run Queue flushErrorJobs
Clone this wiki locally