我只是想运行一个 Event & Listener 循环并将模型传递给它
event(new LabelsCreated($model, 'string'));
这与 QUEUE_CONNECTION=database
完美配合,但与 QUEUE_CONNECTION=redis
配合使用时,它会抛出错误:
#message: "Array to string conversion"
#code: 0
#file: "/home/vagrant/Code/Upworks/myproj/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php"
#line: 302
#severity: 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,
],
它可能指的是键“队列”值吗?
最佳答案
这是我的 config/queue.php 中的问题
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => ['default', 'export'], // THIS LINE
'retry_after' => 90,
'block_for' => null,
],
我试着保持默认
'queue' => 'default'
它在同一连接上运行多个队列。
关于laravel - QUEUE_CONNECTION 'database' 工作但 'redis' 抛出 'Array to String conversion',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57758755/