Laravel queue fails - php

I'm using Laravel forge and I've setup a queue called mail. It handles all mails in my application. When I set the QUEUE_DRIVER to sync in my .env file all mails are being send as expected. But when I use the QUEUE_DRIVER=beanstalkd mails do not send.
When I listen for the queue php artisan queue:work --queue=mail I can see that the jobs are being handled.
Already restarted the queue and recreated it. But nothing seems to work. When I look into my jobs table there are no errors. What on earth could be going on?

Related

Issue with Redis managing Laravel Queues

I am using Laravel forge with Redis as the queue driver.
I have updated the code for my application to send push notifications a few times over, but the notifications sent are as in the old code.
Changing the queue driver to database, sends the notifications as per the latest updates. However when I switched it back to Redis, it still shows old version of the notification.
I have done "FLUSHALL" via redis-cli, but it didn't fix it.
Also I use Laravel Horizon to manage queues.
How I can fix this? Thanks in advance.
Edit: Other thing I noticed was all code driven dispatches were queued on Redis. I have listed the solution in the answer in the hopes it would help someone else.
What I received from Forge support:
Hello,
There might be a worker that's stuck you can try and run php artisan
horizon:purge which should kill all rogue worker processes, and then
restart the daemon. It's advised to run the purge command in your
deployment script to make sure all stale processes are killed.
-- Mohamed Said forge#laravel.com
However this how I got it sorted:
php artisan horizon:terminate
php artisan queue:restart
And then the code was working properly
Stop redis, Stop Horizon workers. Start redis and then start horizon workers.
But before these all clear cache.
I had similar problem and in my case it was just the matter of restart all the services.

Sending Laravel Queue Message Using SQS Amazon

I'm using sqs queue in my laravel. Right now I have successsfully pushed my queue job to sqs server as shown in the picture below :
The problem is, the message is never got executed. So how to process this message on SQS...??
Thanks a lot
I think you forgot to run the queue daemon.
Try to run php artisan queue:listen in the project folder.

Laravel not performing job queue with database

I am trying to perform a job queue to execute mail and sms functioning in background process. And it is working with
QUEUE_DRIVER=sync
in .env file
But when i use it with database
QUEUE_DRIVER=database
its not working even after using cli command:
php artisan queue:listen
Please tell me what is the problem with such functionality
laravel.log:
here is how i would debug it:
stop supervisor if you are using it.
cd into your directory and type php artisan queue:listen if you see any errors then likely you have some issues with the job class that you are running laravel 5.2 give you the path in the error and if you look closely you can see in the database the parameters that were passed to the constructor.
also check to see if the reserved field in the jobs table is filled, and the attempts are more than 1.
if the attempts are 0 that means you have a problem with your supervisor service (if you are using it) try unlink /path/to/socket.sock and then run the supervisord command.

Best environment practice when working with Queues in Laravel

I have an application which uses queues in order to send emails.
In a production environment, should I run the queue:listen command in the same application server where the application resides? Or should I do outsorcing?
So far,I've been in a dev environment working with two command lines, one for the php artisan serve command in order to get the application running and the other for the php artisan queue:listen command. If outsorcing is better for production environment, would I have to modify my code so I can work with Beanstalkd, Amazon SQS or another?
Reference Link ::
http://laravelcoding.com/blog/laravel-5-beauty-sending-mail-and-using-queues#14-about-queues
Helped me with my approach for sending notification message to gcm and to the registered mobiles.

Laravel queue external server

I have the following servers configured:
App Server is running LAMP with Laravel 5.1
Queue Server is running Beanstalkd and Supervisord
I want to be able to send jobs in Laravel on the App Server to the Queue Server which will simply run a DB insert. I was hoping to use Laravel's job queueing to do this but from my understanding it would then require me to have the same Laravel project on both hosts? It seems like it sends the class to execute, not the data itself. Perhaps I have a bad understanding of how Beanstalkd works? Should I be using something like RabbitMQ instead?
Any help would be greatly appreciated!

Categories