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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据