0

我只是想运行一个事件和监听器循环并将一个模型传递给它

event(new LabelsCreated($model, 'string'));

这与 完美配合,QUEUE_CONNECTION=databaseQUEUE_CONNECTION=redis它会给我一个错误:

#message:“数组到字符串的转换”

#代码:0

#file:“/home/vagrant/Code/Upworks/myproj/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php”

#线:302

#严重性:E_NOTICE

我的事件类如下所示:

class LabelsCreated
{
    use Dispatchable, SerializesModels;

    public $model;

    public $string;

    public function __construct($model, $string)
    {
        $this->model = $model;
        $this->string = $string;

        // comes here
    }
}

但它根本没有让我的听众排队。


我的 config/queue.php,redis 数组如下所示:

'redis' => [
        'driver' => 'redis',
        'connection' => 'default',
        'queue' => ['default', 'export'],
        'retry_after' => 90,
        'block_for' => null,
 ],

它可能指的是关键的“队列”值吗?

4

1 回答 1

0

这是我的 config/queue.php 中的问题

'redis' => [
        'driver' => 'redis',
        'connection' => 'default',
        'queue' => ['default', 'export'], // THIS LINE
        'retry_after' => 90,
        'block_for' => null,
 ],

我尝试将其保留为默认值

'queue' => 'default'

它在同一个连接上运行多个队列。

深入了解:https ://laracasts.com/discuss/channels/laravel/multiple-queues-for-redis-connection?page=0#reply=461404

于 2019-09-02T14:45:58.720 回答