php-resque/resque-bundle

This package is abandoned and no longer maintained. The author suggests using the resquebundle/resque package instead.

PHP Resque bundle

Installs: 25

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 3

Forks: 0

Open Issues: 2

Type:symfony-bundle

dev-master 2016-01-13 02:23 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:52:20 UTC


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