awellis13/laravel-resque

此包已废弃,不再维护。未建议替代包。

Laravel Resque 队列连接器。

1.2.2 2014-04-17 01:03 UTC

This package is not auto-updated.

Last update: 2019-02-20 17:32:02 UTC


README

已废弃! 我已经非常忙碌于其他项目,没有时间关注这个项目。如果有人愿意接管它的开发,我非常愿意将你添加为仓库的贡献者,以便你管理它。直到有人接管,这将继续被标记为废弃。

Laravel Resque

此包允许您在使用 Queue 时连接到 Resque。

要求

  • PHP 5.4+
  • Illuminate\Config 4.1+
  • Illuminate\Queue 4.1+
  • Resque 1.2
  • ResqueScheduler 1.1(可选)

安装

首先,您需要将以下内容添加到项目的 composer.json

"require": {
	"awellis13/laravel-resque": "1.2.x"
}

现在,您需要运行以下命令来安装包

composer update

接下来,您需要将以下服务提供者添加到您的 app/config/app.php

'Awellis13\Resque\ServiceProviders\ResqueServiceProvider'

现在,您需要将以下内容添加到您的 /app/config/queue.php 的 "connections" 部分

"resque" => [
	"driver" => "resque"
]

如果您希望将此驱动程序用作默认队列驱动程序,您需要在 app/config/queue.php 中将以下内容设置为 "default" 驱动

"default" => "resque",

用法

如果您选择不使用此驱动程序作为默认队列驱动程序,您可以通过以下方式按需调用队列方法

Queue::connection('resque')->push('JobName', ['name' => 'Andrew']);

排队一个工作

Queue::push('JobName', ['name' => 'Andrew']);

跟踪一个工作

$token = Queue::push('JobName', ['name' => 'Andrew'], true);
$status = Queue::getStatus($token);

排队一个未来的工作

$when = time() + 3600; // 1 hour from now
Queue::later($when, 'JobName', ['name' => 'Andrew']);

进一步文档

许可

Laravel Resque 是在 MIT 许可证 下授权的开源软件。