Laravel:正在运行的队列:在Windows Azure Web App上连续监听 [英] Laravel: Running queue:listen continuously on Windows Azure Web App

查看:54
本文介绍了Laravel:正在运行的队列:在Windows Azure Web App上连续监听的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问这个问题我有点傻,但是我似乎无法在互联网上找到这个问题的答案.经过几个小时的搜索,我发现在Linux服务器上,您可以使用Supervisor在您的网站上连续运行"php artisan queue:listen"(带有或不带有守护程序),以处理推送到队列中的作业.这一切都很好,但是如果我想在Windows Azure Web应用程序上执行此操作怎么办?搜索解决方案后,我发现:

I feel a little bit silly for asking this question but I can't seem to find an answer on the internet for this problem. After searching for several hours I figured out that on a linux server you use Supervisor to run "php artisan queue:listen" (either with or without daemon) continuously on your website to handle jobs pushed to the queue. This is all well and good, but what if I want to do this on a Windows Azure web app? After searching around the solutions I found were:

  • 安排一个计时工作来每分钟(或每X分钟)运行"php artisan queue:listen",我真的不喜欢此解决方案,并希望在网站获得更多流量的情况下特别避免使用它;
  • 添加一个连续运行"php artisan queue:listen"的WebJob(这里的问题是我不知道如何为该WebJob编写脚本...);

我想请大家帮忙,以了解其中哪种是正确的解决方案,是否有更好的解决方案,以及WebJob是最好的解决方案,我该如何编写脚本?预先感谢.

I want to ask you guys for help on to know which of these is the correct solution, if there is a better one and if the WebJob is the best one how do I write the script for this? Thanks in advance.

推荐答案

简而言之,Supervisor是nohup(不挂断)的现代替代品,并附加了其他点点滴滴.简而言之,还有其他资源可以使任务在后台运行(守护程序),而我用于基于Windows的项目(很少tbh)使用的解决方案是Forever,我通过以下方式发现了它:

In short, Supervisor is a modern alternative to nohup (no hang up) with a few other bits and pieces tacked on. In short, there's other resources that can keep a task running in the background (daemon) and the solution I use for Windows based projects (very few tbh) is Forever which I discovered via: https://stackoverflow.com/a/18226392/5912664

C:\myprojectroot > forever -c php artisan queue:listen --queue=some_nice_queue --tries=3

如何?

为Windows安装node,然后通过npm安装Forever

Install node for Windows, then with npm install Forever

C:\myprojectroot > npm install -g forever

如果您不愿意让Node在Windows上运行,建议您使用Windows软件包管理器Chocolatey

If you're stuck for getting Node running on Windows, I recommend the Windows Package Manager, Chocolatey

https://chocolatey.org/packages?q=node

请确保检查Forever创建的所有日志文件,因为我留下了足够长的时间来消耗30Gb的磁盘空间!

Be sure to check for any logfiles that Forever creates, as I had left one long enough to consume 30Gb of disk space!

这篇关于Laravel:正在运行的队列:在Windows Azure Web App上连续监听的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆