简体   繁体   English

Laravel Mail :: queue not async

[英]Laravel Mail::queue not async

I have a problem with laravel 5.1 queues. 我有laravel 5.1队列的问题。 I have beanstalkd already set up in my Homestead vm so all i did was to change the queue driver from the default one to beanstalkd in config/queue.php . 我已经在我的Homestead vm中设置了beanstalkd,所以我所做的只是将队列驱动程序从default一个beanstalkdconfig/queue.php I've tried the code below and neither one seem to be queued. 我已经尝试了下面的代码,似乎没有人排队等候。 They all fired synchronously, as soon as i run the code. 一旦我运行代码,它们都会同步启动。 I didn't even fire the artisan queue:listen command. 我甚至没有解雇artisan queue:listen命令。 What am i doing wrong? 我究竟做错了什么?

Route::get('/', function () {
//    return view('welcome');

    Queue::push(function($job)
    {
        Log::info("Dadas");
        $job->delete();
    });

    $input = [
        'name' => 'Mario Bašić',
        'email' => 'email@me.com',
        'comment' =>  'Testing queues',
        'subject' =>  'Email subject'
    ];

    Mail::queue('emails.test', $input, function($message) use ($input)
    {
        $message->to($input['email'], $input['name']);
        $message->subject($input['subject']);
        Log::info('sending');
    });
});

Make sure you change the driver in the .env file: 确保更改.env文件中的驱动程序:

QUEUE_DRIVER=beanstalkd

Changing the value in the config/queue.php to: config/queue.php的值更改为:

'default' => env('QUEUE_DRIVER', 'beanstalkd'),

won't work if another value is set for QUEUE_DRIVER in .env . 如果在.envQUEUE_DRIVER设置了另一个值,则.env

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM