LARAVEL5.1中的RbbitMQ ::在没有队列处理的情况下调用作业类的handle方法?

时间:2015-08-05 18:30:56

标签: rabbitmq amqp laravel-5.1

laravel5.1中的RABBITMQ连接设置

'rabbitmq' => [
                'driver'          => 'rabbitmq',

                'host'            => env('RABBITMQ_HOST', '127.0.0.1'),
                'port'            => env('RABBITMQ_PORT', 5672),

                'vhost'           => env('RABBITMQ_VHOST', '/'),
                'login'           => env('RABBITMQ_LOGIN', 'guest'),
                'password'        => env('RABBITMQ_PASSWORD', 'guest'),

                'queue'           => env('RABBITMQ_QUEUE_ABUSE_SCRIPT','abuse'), // name of the default queue,

                'queue_params'    => [
                        'passive'     => env('RABBITMQ_QUEUE_PASSIVE', false),
                        'durable'     => env('RABBITMQ_QUEUE_DURABLE', true),
                        'exclusive'   => env('RABBITMQ_QUEUE_EXCLUSIVE', false),
                        'auto_delete' => env('RABBITMQ_QUEUE_AUTODELETE', false),
                ],

                'exchange_params' => [
                        'type'        => env('RABBITMQ_EXCHANGE_TYPE', 'direct'), 
                        'passive'     => env('RABBITMQ_EXCHANGE_PASSIVE', false),
                        'durable'     => env('RABBITMQ_EXCHANGE_DURABLE', true), // the exchange will survive server restarts
                        'auto_delete' => env('RABBITMQ_EXCHANGE_AUTODELETE', false),
                ],

        ],  

将作业推入队列的代码

$job = (new AddIp());  
$this->dispatch($job);  
//handle method body
public function handle()
{  
    $testQueue = new TestQueue();   
    $testQueue->process_order= '1';         
    $testQueue->save();
}  

启动列表器

php artisan queue:listen rabbitmq  

每当我尝试将作业添加到队列中时,其句柄方法在没有队列处理的情况下调用,即使我没有在队列侦听器窗口中看到任何消息,所以我请求你在这里发生了什么,我不知道? ??

1 个答案:

答案 0 :(得分:0)

1)运行作曲家更新
2)并重新配置https://github.com/fintech-fab/laravel-queue-rabbitmq
3)完成上述两项工作。