I've been trying to send a Mail with Lumen using Queue , the Mail is sent correctly, but when Implement ShouldQueue
stops working, I'm using the database driver and I have the two necessary tables in the database, also before sending the Mail I do a php artisan queue:listen
, then I will leave all the files in which I have configuration to use the Queue
app.php In app.php I use phanan / cascading-config to configure the mail and the services and I also added the queue to be configured
$app->configure('queue');
$app->configure('mail');
$app->configure('services');
Mailable My mailable class is the following
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class RegistroCorrecto extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('registro');
}
}
lumen-framework / config / queue.php
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Driver
|--------------------------------------------------------------------------
|
| The Laravel queue API supports a variety of back-ends via an unified
| API, giving you convenient access to each back-end using the same
| syntax for each one. Here you may set the default queue driver.
|
| Supported: "null", "sync", "database", "beanstalkd", "sqs", "redis"
|
*/
'default' => env('QUEUE_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 60,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 60,
],
'sqs' => [
'driver' => 'sqs',
'key' => 'your-public-key',
'secret' => 'your-secret-key',
'queue' => 'your-queue-url',
'region' => 'us-east-1',
],
'redis' => [
'driver' => 'redis',
'connection' => env('QUEUE_REDIS_CONNECTION', 'default'),
'queue' => 'default',
'retry_after' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => env('QUEUE_FAILED_TABLE', 'failed_jobs'),
],
];
And finally, I send the email:
Mail::to('[email protected]')->send(new RegistroCorrecto());
The errro that returns Lumen is the following
Fatal error: Uncaught UnexpectedValueException: The stream or file "/Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/storage/logs/lumen.log" could not be opened: failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array) #3 /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/laravel/lumen-framework/sr in /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
Fatal error: Uncaught UnexpectedValueException: The stream or file "/Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/storage/logs/lumen.log" could not be opened: failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array) #3 /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vend in /Applications/XAMPP/xamppfiles/htdocs/HtdocsBueno/Cucuuu/CucuuuApi/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
Thanks in advance