it shouldn.t work without having a terminal to listen on the queue ?.. i mean.. that.s my problem .. it doesn.t work if i don.t artisan queue:listen
Queues Working Without Running `queue:listen`
I just stated using madrill to send welcome emails to just registering users. I followed the official docs. Needless to say, setting everything up, was a cinch, really. Once I verified everything was working as expected, I decided to implement a job for sending the emails.
That too was a breeze. I'm using database driver and trying this in my homestead box. Here's what my Job's handle method looks like:
public function handle(Mailer $mailer)
{
$mailer->send(
'emails.welcome', [
'user' => $this->user
],
function($message){
$message->to($this->user->email, $this->user->name)
->from('123@abc.com', 'Welcome')
->subject('Welcome');
var_dump(sprintf(
"Sent Welcome Email to: %s (%s)",
$this->user->name,
$this->user->email
));
}
);
}
This is also working as expected. I receive the welcome email in seconds. What I don't understand is, it seems to be working even if I do not run php artisan queue:listen on my homestead box.
I've created the necessary database tables, using:
queue:table
php artisan queue:failed-table
If I run php artisan queue:listen and watch the terminal, the mail arrives, but the message I'm trying to print from the handle function using var_dump never shows up in the console:
var_dump(sprintf(
"Sent Welcome Email to: %s (%s)",
$this->user->name,
$this->user->email
));
Also, I do not see any entries in the jobs and failed_jobs table in my database.
Could someone shed a light on this please. I guess there's something crucial I'm missing.
Please or to participate in this conversation.