定制 php-resque/resque-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

php-resque/resque-bundle

Composer 安装命令:

composer require php-resque/resque-bundle

包简介

PHP Resque bundle

README 文档

README

Resque for the Symfony Framework.

Build Status: Build Status

This bundle brings you PHP Resque and all of it's features, plus the following:

  • Job targets can be services.
  • Commands to easily manage your background queue.
  • ! Ability to defer jobs to kernel.terminate, for when you're not quite ready for managing background workers.
  • ! Optional ability to map job targets to specific queues. So you can avoid littering the application with queue names.

It however, currently adds the complication that your background workers will need to halt/reload for application changes.

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require php-resque/resque-bundle "dev-master"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Resque\Bundle\ResqueBundle\ResqueBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Configure the Bundle

resque:
  adapter: array|predis_resque
  array:
    process_on_terminate: true
  predis_resque:
    host: 127.0.0.1

Usage

You can use the PHP Resque bundle in two ways. Console commands and in code through the resque service.

Commands

! If you've configured the bundle to use a persisting adapter, the following commands will also act as a working example.

Job enqueue

$ app/console resque:enqueue acme 'Resque\Bundle\ResqueBundle\ExampleJob'
$ app/console resque:enqueue high-priority resque.job.example ?name=Fabian

Queue list

$ app/console resque:queue:list

Queue delete

$ app/console resque:queue:delete acme

Worker start

$ app/console resque:worker:start high-priority,acme

Worker list

$ app/console resque:queue:list

Worker stop

$ app/console resque:queue:stop --all

All commands make extensive usage of --help, if you want further information.

PHP

!

<?php

$resque = $container->get('resque');

// @todo 

统计信息

  • 总下载量: 25
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-26