mcfedr/resque-bundle

此包已被废弃且不再维护。作者建议使用mcfedr/queue-manager-bundle包代替。

resque的扩展包

安装数量: 14,894

依赖者: 0

推荐者: 0

安全: 0

星标: 9

关注者: 2

分支: 2

开放问题: 0

类型:symfony-bundle

4.1.1 2017-04-24 11:38 UTC

This package is auto-updated.

Last update: 2019-02-20 19:44:37 UTC


README

用于管理php-resque作业的扩展包

Latest Stable Version License Build Status SensioLabsInsight

要求

您需要一个Redis服务器

您可以尝试以下内容

apt-get install redis-server

或者

brew install redis

安装

Composer

php composer.phar require mcfedr/resque-bundle

AppKernel

将扩展包包含在您的AppKernel中

public function registerBundles()
{
    $bundles = array(
        ...
        new Mcfedr\ResqueBundle\McfedrResqueBundle(),

配置

您的配置应类似于以下内容

mcfedr_resque:
    host: 127.0.0.1
    port: 6379
    default_queue: default
    prefix: 'my_app:'

选项

  • host - Redis的主机名
  • port - Redis的端口
  • prefix - Redis中resque键的前缀 - 当在单个Redis主机上运行多个resque实例时,使用此前缀以完全分离它们
  • default_queue - 如果未指定,则使用的队列名称
  • debug - 如果设置为true,则不会实际调用Resque
  • track_status - 设置为true以启用所有作业的作业跟踪

用法

  1. 您的后台任务是实现了Mcfedr\ResqueBundle\Worker\WorkerInterface的服务

  2. 使用mcfedr_resque.manager将任务放入队列

  3. 运行resque工作进程

    VVERBOSE=1 QUEUE=default APP_INCLUDE=app/bootstrap.php.cache PREFIX="my_app:" REDIS_BACKEND=127.0.0.1:6379 ./bin/resque

  4. 可选的,运行调度器

    VVERBOSE=1 PREFIX="my_app:" REDIS_BACKEND=127.0.0.1:6379 ./bin/resque-scheduler

测试

./vendor/bin/phpunit