Dan
Dan

Reputation: 3103

Laravel Mail::queue not async

I have a problem with laravel 5.1 queues. 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. 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. 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 protected]',
        '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');
    });
});

Upvotes: 3

Views: 1323

Answers (1)

Bogdan
Bogdan

Reputation: 44546

Make sure you change the driver in the .env file:

QUEUE_DRIVER=beanstalkd

Changing the value in the config/queue.php to:

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

won't work if another value is set for QUEUE_DRIVER in .env.

Upvotes: 3

Related Questions