PHPackages                             resquebundle/resque - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. resquebundle/resque

ActiveSymfony-bundle[Caching](/categories/caching)

resquebundle/resque
===================

A Symfony 4 bundle to manage Resque job queues

5.0.3(4y ago)51139.2k↓39.2%27[4 issues](https://github.com/resquebundle/resque/issues)[1 PRs](https://github.com/resquebundle/resque/pulls)1MITPHPPHP &gt;=8CI failing

Since Aug 3Pushed 3y ago4 watchersCompare

[ Source](https://github.com/resquebundle/resque)[ Packagist](https://packagist.org/packages/resquebundle/resque)[ Docs](https://github.com/resquebundle/resque/)[ RSS](/packages/resquebundle-resque/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (5)Versions (38)Used By (1)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a13dec540c787d17aa571e0a9f533455e4f0721c524e421fb4b9496d9bdf0d73/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f72657371756562756e646c652f7265737175652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/resquebundle/resque/?branch=master)

**This project IS NO LONGER UNDER ANY development (last major update September 2021)**

If you would like to take over maintenance of this project please contact  - I no longer use the code here in any live project as I moved to [Symfony Messenger](https://symfony.com/doc/current/messenger.html), with Redis. for my own queue needs.

If you are using PHP 8 plesae see the `php8` branch for the latest stable release
=================================================================================

[](#if-you-are-using-php-8-plesae-see-the-php8-branch-for-the-latest-stable-release)

ResqueBundle
============

[](#resquebundle)

Compatibiltiy
-------------

[](#compatibiltiy)

- For Symfony 5+ please use ResqueBundle v4.0.0+
- For Symfony 4+ please use major series ResqueBundle v3+ and work towards Symfony 5 migration ;-)
- For Symfony 3+ please peg to exact release ResqueBundle v2.0.9+ and think about your decision to even use Symfony 3 ;-)

Note that we dont offer the same b/c promise as symfony itself, but try our hardest to make major versions for major symfony versions.

Update May 2020
---------------

[](#update-may-2020)

- Inject ParameterBagInterface instead of directly accessing container in commands and controller
- User kernel.project\_dir instead of kernel.root\_dir (b/c break!, you need to update your config yml)
- Update Routing controller to use long syntax
- Use `@Bundle` syntax for loading twig templates
- force a minimum of Symfony 4.1.2 for critical security
- Use correct Process function for max compatibility
- Drop Symfony 3.4 support totally, sorry.

Update November 2019
--------------------

[](#update-november-2019)

I have now worked on the master branch to implement compatibility with Symfony 4+, using Dependancy injection instead of `ContainerAwareJob`.

If you are still using Symfony 3 then you MUST peg your composer.json to release 2.0.9

The first version of this bundle that is highly compatible with, and activly maintained, is 3.0.0

If you have used this before, and want to get up to date, then you need to

- upgrade to 3.0.0+ version of this bundle
- use Symfony 4 (im using 4.4.0RC1 at the moment)
- change your Jobs to extend `ResqueBundle\Resque\Job` and not `ContainerAwareJob`
- add `__construct` methods to inject your depenancies
- remove ALL REFERENCES to the container or `getContainer` from your jobs
- Enjoy!

ResqueBundle History
====================

[](#resquebundle-history)

This is a fork of the BCCResqueBundle as \***that** bundle is no longer being actively maintained. There are a lot of outstanding issues, pull requests and bugs that need to be fixed in that project, with no activity, so we forked it, and will activly support and develop the code further in this repo.

This is also a rebrand of Mpclarkson\\ResqueBundle to place the code under a GitHub Organisation for future proof distributed development

**Contributions are welcome**

The resque bundle provides integration of [php-resque](https://github.com/chrisboulton/php-resque/) to Symfony4. It is inspired from resque, a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.

Features:
---------

[](#features)

- Creating a Job, with container access in order to leverage your Symfony services
- Enqueue a Job with parameters on a given queue
- Creating background worker on a given queue
- An interface to monitor your queues, workers and job statuses
- Schedule jobs to run at a specific time or after a number of seconds delay
- Auto re-queue failed jobs, with back-off strategies
- Dependency Injection to Jobs

Installation and configuration:
-------------------------------

[](#installation-and-configuration)

### Requirements

[](#requirements)

Symfony 4+

### Get the bundle

[](#get-the-bundle)

To install, run `composer req resquebundle/resque`

### Import the routing configuration

[](#import-the-routing-configuration)

Add to the following to `routing.yml`:

```
# app/config/routing.yml
ResqueBundle:
    resource: "@ResqueBundle/Resources/config/routing.xml"
    prefix:   /resque
```

You can customize the prefix as you wish.

You can now access the dashboard at this url: `/resque`

To secure the dashboard, you can add the following to your `security.yml`, assuming your administrator role is `ROLE_ADMIN`

```
access_control:
  - { path: ^/resque, roles: ROLE_ADMIN }
```

Now only users with the role ROLE\_ADMIN will be able to access the dashboard at this url: `/resque`

### Optional, set configuration

[](#optional-set-configuration)

You may want to add some configuration to your `config.yml`

```
# app/config/config.yml
resque:
    app_include: /pathto/bootstrap.php.cache # app include file if different from default (i.e. /var/bootstrap.php.cache)
    prefix: my-resque-prefix                 # optional prefix to separate Resque data per site/app
    redis:
        host: localhost                      # the redis host
        port: 6379                           # the redis port
        database: 1                          # the redis database
        password: ~                          # the redis password, defaults to null
    auto_retry: [0, 10, 60]                  # auto retry failed jobs
    worker:
        project_dir: path/to/worker/project_dir        # the project_dir of app that run workers (optional)
```

See the [Auto retry](#auto-retry) section for more on how to use `auto_retry`.

Set `worker: project_dir:` in case job fails to run when worker systems are hosted on separate server/dir from the system creating the queue. When running multiple configured apps for multiple workers, all apps must be able to access by the same root\_dir defined in `worker: root_dir`.

Creating a Job
--------------

[](#creating-a-job)

A job is a subclass of the `ResqueBundle\Resque\Job` class.

You will be forced to implement the run method that will contain your job logic:

```
