Laravel Horizo​​n-一名主管运行多个队列

时间:2018-12-19 00:55:53

标签: php laravel laravel-queue laravel-horizon

任何人都可以在horizo​​n.php中进行正确的配置帮助,以使单个主管运行多个队列吗?我尝试过:

'supervisor-1' => [
    'connection' => 'redis',
    'queue' => ['default', 'queue2'],
    'balance' => 'simple',
    'processes' => 10,
    'tries' => 3,
],

以及:

'supervisor-1' => [
    'connection' => 'redis',
    'queue' => 'default, queue2',
    'balance' => 'simple',
    'processes' => 10,
    'tries' => 3,
],

第二个队列在地平线上正确显示,我可以向他们发送作业,但只是没有得到处理。

我已在Forge上进行调配,并使用带有以下queue.php配置的redis来设置我的队列:

'redis' => [
        'driver' => 'redis',
        'connection' => 'default',
        'queue' => 'default', // Default Queue
        'retry_after' => 90,
        'block_for' => null,
    ],

1 个答案:

答案 0 :(得分:0)

config/horizon.php

'supervisor-1' => [
    'connection' => 'redis',
    'queue' => ['default', 'queue2'],
    'balance' => 'simple',
    'processes' => 10,
    'tries' => 3,
],

在主管中:--queue=default,queue2

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/App/artisan queue:listen redis --queue=default,queue2 --sleep=3 --tries=3 
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile= /var/www/html/App/storage/logs/worker.log