Laravel Queue:如何在共享主机上使用 [英] Laravel Queue: How to use on shared hosting

查看:83
本文介绍了Laravel Queue:如何在共享主机上使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了有关使用Beanstalkd等的Laravel Queue的教程,并且使用队列的想法非常棒,因为在我当前的项目中,向注册用户发送Welcome邮件最多需要10秒钟的时间来处理附件的原因徽标.我可以想象,如果更多的用户在一个实例中注册,将会发生什么.因此,为此使用队列将加快处理速度.

I have read tutorials on Laravel Queue using Beanstalkd etc and the idea of using queue is fantastic because in my current project, sending a Welcome mail to a registered user takes up to 10 seconds to process cause of the attachment of a logo. I can imagine what will happen if more users register at an instance. So, using a queue for this will speed up things.

在我正在使用的共享服务器中,没有SSH Access.因此,根据教程设置队列非常困难.

In the shared server I am working on, I have no SSH Access. So, setting up the queue according to the tutorials is far fetched.

我想知道是否可以在不使用SSH Access的情况下设置Laravel Queue,如果可以的话,我需要一个指南.

I want to know if there is a way to setup Laravel Queue without SSH Access, if there is a way, I need a guide.

推荐答案

您无法在共享服务器上使用Beanstalkd,因为您无法安装该服务,而且我不知道任何提供此服务的托管服务共享主机.但是,您可以使用 IronMQ ,它是一个远程托管服务(因此您无需在服务器). Laravel队列API对于任何队列服务都是相同的,因此您可以像使用beanstalkd一样使用Queue::push.

You can't use Beanstalkd on a shared server because you can't install the service and I don't know any hosting service that offers it for shared hosting. However you could use IronMQ which is a remotely hosted service (so you don't need to install anything on the server). The Laravel queues API is the same for any queue service, so you can just use Queue::push like you would with beanstalkd.

以下是Laravel创作者泰勒·奥特威尔(Taylor Otwell)制作的精彩视频,内容如下: http://vimeo.com/64703617 .您还可以阅读此教程,其中详细说明了如何将IronMQ与Laravel结合使用

Here's a great video on setting this up by Taylor Otwell, the creator of Laravel: http://vimeo.com/64703617. You can also read this tutorial which explains how to use IronMQ with Laravel in more detail.

IronMQ是一项付费服务​​,但是它确实为开发人员提供了免费计划,每月提供一百万个API请求.

IronMQ is a paid service, but it does have a Free Plan for developers which offers 1 million API requests per month.

您不必像使用beanstalkd那样使用artisan queue:listen,而是只需定义IronMQ在处理队列中的每个作业时要调用的路由即可:

Instead of using artisan queue:listen like you would for beanstalkd, you just define a route for IronMQ to call when processing each job on the queue:

Route::post('queue/receive', function()
{
    return Queue::marshal();
});

这篇关于Laravel Queue:如何在共享主机上使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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