How does Laravel queue work and what if php artisan queue:listen stops

后端 未结 2 883
闹比i
闹比i 2021-02-08 10:30

I have installed beanstaled and its working fine with laravel. The point where I am puzzled is that we have to do

php artisan queue:listen

to

相关标签:
2条回答
  • 2021-02-08 10:54

    you need to install supervisor also. Here is a tutorial on using beanstalkd with laravel:

    http://fideloper.com/ubuntu-beanstalkd-and-laravel4

    Here are details on supervisor also:

    http://supervisord.org/installing.html

    I personally use a redis instance and run my queue with supervisor from there. I find its a bit more memory effective then beanstalkd personally but each to there own.

    Supervisor will execute the queue:listen command from artisan and this will run a job, if you have multiple supervisor processes then you can run multiple in line items. depending on what you are doing i would almost look into python and multithereading also as i have used this for a few things i used to use a queue for and it has provided even better results.

    example config file for supervisor:

    [program:myqueue]
    command=php artisan queue:listen --env=your_environment
    directory=/path/to/laravel
    stdout_logfile=/path/to/laravel/app/storage/logs/myqueue_supervisord.log
    redirect_stderr=true
    autostart=true
    autorestart=true
    
    0 讨论(0)
  • 2021-02-08 11:07

    You can also make use of Laravel's Task Scheduler i.e add the php artisan queue:listen command to the scheduler and sets its frequency to whatever you wants.

    So that will make sure to call queue listen process automatically.

    Hope it will make sense.

    0 讨论(0)
提交回复
热议问题