dongpu5600 2014-03-06 15:41
浏览 66
已采纳

Laravel 4 + Iron Mq:队列被解雇但邮件未发送

This is the situation:

I have a Laravel 4 app with Iron mq installed in order to speed up the process. It is possible to book a car and to register in the site. In both cases a mail is sent. The problem is that after installing Iron mq the mail are not sent anymore. All the rest is done, inserting data in the database, but the mails sending no. In Iron mq dashboard the queues are instead regularly received and apparently fired..

This is the route:

 /*  CARS  */

Route::get('focus', function()
 {
return View::make('iframe');
 });
Route::post('focus', 'RegistrationsController@booking');


Route::get('sharan', function()
{
return View::make('iframe2');
 });


Route::get('passat', function()
{
return View::make('iframe5');
});

// Route::post('passat', 'RegistrationsController@booking');

 Route::post('passat', function()
 {
return Queue::marshal();    
 });

/*  USER REGISTRATION */

Route::get('register', 'HomeController@getRegister');
Route::post('register', 'HomeController@postRegister');

Right now the process of book a car is faster, from 8/9 sec to 3 sec. It means that Iron is working. Though is strange that i had make the Queue::marshall() for only one of the post route, and it works for all three.. The user registration is also faster, without any queue::marshall() But the point is that in the both cases no email is sent.

This is the mail sending code:

 return \Mail::queue($this->view, $this->data, function($message) use($self)
{
   $message->to($self->email, $self->to)->subject($self->subject);

});

With Mail::send it works (but terribly slow), with Mail::queue is faster but the email is not sent.

The main questions are:

Why the mail are not sent? The SMTP settings should not change, right?

What is the proper place for Queue::marshall() ? If for the POST of the registration i must call the proper method Route::post('register', 'HomeController@postRegister'); Then, where i have to put the Queue::marshall() ? Is possible to make a double route? Call the method and make Queue::marshall?

Thank you very much! Already for a previous site had the same problems and never resolve.

  • 写回答

1条回答 默认 最新

  • dongyingjiu0669 2014-03-06 15:52
    关注

    The objective of this marshal call is just to make your application process your queues jobs. So, create a separate route for your marshal, it will be used only by Iron:

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

    Then you just have to subscribe your marshal url in your Iron queue:

    http://yoursite.com/queues/marshal
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 5037端口被adb自己占了
  • ¥15 Error in check.length("fill") : 'gpar'成分'fill'的长度不能为零
  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误