【问题标题】:Laravel 4.1 + Push Queues + Error QueuesLaravel 4.1 + 推送队列 + 错误队列
【发布时间】:2014-03-05 02:37:26
【问题描述】:

我的目标是在推送消息在 X 次尝试后失败时以某种方式通知我。

Iron.io 推送队列文档描述:错误队列 http://dev.iron.io/mq/reference/push_queues/#error_queues

按照文档,我必须定义一个 error_queue 选项,以便失败的消息触发指定 error_queue 选项中的消息。

如果 IronQueue.php 中的 push 方法不支持选项参数,我该如何定义选项。我看到 pushRaw 确实支持选项参数。

如何将以下推送示例转换为 pushRaw

Route::get('someroute', function()
{
    Queue::push('SomeClass', array('time' => time()));
});

class SomeClass{
    public function fire($job, $data)
    {
        // do something
        $job->delete();
    }
}

也欢迎使用其他检测推送队列失败的方法。

【问题讨论】:

    标签: laravel-4 iron.io push-queue


    【解决方案1】:

    正如@cmancre 所说,您可以使用 HUD 设置错误队列,也可以使用 API 进行设置:http://dev.iron.io/mq/reference/api/#update_a_message_queue

    【讨论】:

      【解决方案2】:

      Iron 家伙刚刚推出了一个 UI,允许我们通过 Iron 管理面板设置 error_error。

      【讨论】:

        【解决方案3】:

        如果您的 error_queue 已经触发,要完成循环,您需要知道哪条消息失败了。

        要获取错误消息信息,在error_queue 路由中执行以下操作:

        // First we fetch the Request instance
        $request = Request::instance();
        
        // Now we can get the content from it
        $content = $request->getContent();
        

        参考:http://www.codingswag.com/2013/07/get-raw-post-data-in-laravel/

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2019-07-03
          • 1970-01-01
          • 2014-05-07
          • 2017-07-16
          • 2015-12-19
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多