【发布时间】:2019-09-02 14:34:29
【问题描述】:
我只是想运行一个 Event & Listener 循环并将模型传递给它
event(new LabelsCreated($model, 'string'));
这与QUEUE_CONNECTION=database 完美配合,但与QUEUE_CONNECTION=redis 配合使用,会引发错误:
#message: "数组到字符串的转换"
#code: 0
#file: "/home/vagrant/Code/Upworks/myproj/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php"
#line: 302
#severity: E_NOTICE
我的 Event 类如下所示:
class LabelsCreated
{
use Dispatchable, SerializesModels;
public $model;
public $string;
public function __construct($model, $string)
{
$this->model = $model;
$this->string = $string;
// comes here
}
}
但它根本没有让我的 Listener 排队。
我的config/queue.php,redis数组长这样:
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => ['default', 'export'],
'retry_after' => 90,
'block_for' => null,
],
可能是指关键的“队列”值吗?
【问题讨论】:
-
你从哪里得到
$transaction? -
在我的问题中尝试更通用时是一个错字。这只是一个模型。修正错字
标签: laravel laravel-5 redis laravel-queue laravel-horizon