多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 事件监听者指定队列名称 ``` namespace App\Listeners; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; class ProcessTask implements ShouldQueue { use InteractsWithQueue; /** * 任务将被发送到的队列的名称 * * @var string|null */ public $queue = 'cate_rule_match'; } ``` ## 队列指定队列名称 ``` namespace App\Jobs; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; class ProcessTask implements ShouldQueue { use Dispatchable, InteractsWithQueue, SerializesModels; /** * Create a new job instance. * * @return void */ public function __construct() { $this->onQueue('queue_name'); } } ``` 或者 ~~~ ProcessTask::dispatch()->onQueue('queue_name'); ~~~