问题
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.
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.
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.
回答1:
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.
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 is a paid service, but it does have a Free Plan for developers which offers 1 million API requests per month.
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();
});
来源:https://stackoverflow.com/questions/26729445/laravel-queue-how-to-use-on-shared-hosting