企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 事件监听者指定队列名称 ``` 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'); ~~~