whatknight/laravel-resque-ex

Laravel Resque 队列连接器。

1.0.0 2014-09-16 21:27 UTC

This package is not auto-updated.

Last update: 2024-09-24 07:12:02 UTC


README

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

这是 awillis13 的 laravel-resque 的分支,使用了 kamisama 的 chrisboulton 的 php-resque 分支。

要求

  • PHP 5.4+

安装

将以下内容添加到您的项目的 composer.json 文件中

"require": {
	"whatknight/laravel-resque": "1.0.0"
}

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

composer update

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

'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 许可证 授权。