IronMq + Laravel4:提交作业但Queue无法正常工作

时间:2014-12-22 21:35:23

标签: laravel laravel-4 ironmq

我正在尝试将新用户添加到群组并发送激活电子邮件。当我在没有队列的情况下实现它时,它工作得更早。

这是我在app / routes.php中的(相关)代码:

Queue::getIron()->ssl_verifypeer = false;

Route::post('queue/demo', function(){
    Log::info('marshal!');
    return Queue::marshal();
});

class FinishUserRegistration{
public function fire($job, $data){
    $user_id = $data['user_id'];
    $usergroup = Sentry::getGroupProvider()->findById(2);
    $newuser = Sentry::findUserById($user_id);
    $newuser->addGroup($usergroup);
    $emailData = array(
        'user_name' => $newuser->first_name . ' ' . $newuser->last_name,
        'activation_code' => $newuser->getActivationCode(),
        'user_id' => $newuser->id,
        'repeat' => false,
    );
    Mail::send('emails.activation', $emailData, function ($message) use($user_id){
        $newuser = Sentry::findUserById($user_id);
        $message->to($newuser->email, $newuser->first_name . ' ' . $newuser->last_name)->subject('Welcome to The Site!');
    });

    $job->delete();
}
}

在UsersControlller.php中,我有:

public function postModalRegister(){
    $user = Sentry::createUser($input);
    /*
    $user->addGroup($usergroup);
    $this->activationMail($user->id, false);
    */

    Queue::push('FinishUserRegistration', ['user_id'=>$user->id]);

    return \Response::json(['success' => true], 200);
}

我已按照IronMq + Laravel4: How make it working的说明操作。 当我注册一个新用户时,我收到了成功,我可以在IronMQ仪表板中看到消息计数增加。但laravel.log并没有显示" marshal!",当我卷曲时也不会这样做 - 数据" param1 =无论什么" http://livesite.com/queue/demo

另外,我有

Route::when('*', 'csrf', array('post', 'put', 'delete', 'patch'));

在我的路由文件中,所以队列/演示路由在过滤之前也有一个csrf。

0 个答案:

没有答案