Download the PHP package instasent/resque-bundle without Composer

On this page you can find all versions of the php package instasent/resque-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package resque-bundle

Intro to InstasentResqueBundle

This is a fork from https://github.com/michelsalib/InstasentResqueBundle in order to keep its maintenance.

The Instasent resque bundle provides integration of php-resque to Symfony. It is inspired from resque, a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.

Features:

TODOs:

Screenshots

Dashboard

Installation and configuration:

Requirements

Make sure you have redis installed on your machine: http://redis.io/

Get the bundle

Add to your instasent-resque-bundle to your dependencies:

To install, run php composer.phar [update|install].

Add InstasentResqueBundle to your application kernel

Import the routing configuration

Add to your routing.yml:

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 - provided your administrator role is ROLE_ADMIN

Optional, secure the dashboard behind a role

Add to your security.yml:

Now only users with the role ROLE_ADMIN will be able to access the dashboard at this url: /resque

Optional, set configuration

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

See the Auto retry section for more on how to use auto_retry.

Set worker: root_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.

Optional, configure lazy loading

This bundle is prepared for lazy loading in order to make a connection to redis only when its really used. Symfony2 supports that starting with 2.3. To make it work an additional step needs to be done. You need to install a proxy manager to your Symfony2 project. The full documentation for adding the proxy manager can be found in Symfony2's Lazy Service documentation.

Creating a Job

A job is a subclass of the Instasent\ResqueBundle\Job class. You also can use the Instasent\Resque\ContainerAwareJob if you need to leverage the container during job execution. You will be forced to implement the run method that will contain your job logic:

As you can see you get an $args parameter that is the array of arguments of your Job.

Adding a job to a queue

You can get the resque service simply by using the container. From your controller you can do:

Running a worker on a queue

Executing the following commands will create a work on :

You can also run a worker foreground by adding the --foreground option;

By default VERBOSE environment variable is set when calling php-resque

See php-resque logging option : https://github.com/chrisboulton/php-resque#logging

Use monolog from your kernel

You can pass a monolog channel to write your logs, see example in supervisor config. Note: Pass Kernel ENV to resque is to instanciate logger, no for sharing kernel between jobs.

Running a worker without forking

Sometimes intensive tasks may lose performance with forking mode. We have added a bin/resque-single binary, you can pass kernel file to be loaded only once at start. Be carefull cause if this Worker fails, then you need to restart manually this worker. We recommend to use supervisor to control this, and superlance with memory plugin to restart worker when hits some memory treshold. Be careful too with your code, shared variables, services instances... etc.

Adding a delayed job to a queue

You can specify that a job is run at a specific time or after a specific delay (in seconds).

From your controller you can do:

You must also run a scheduledworker, which is responsible for taking items out of the special delayed queue and putting them into the originally specified queue.

app/console instasent:resque:scheduledworker-start

Stop it later with app/console instasent:resque:scheduledworker-stop.

Note that when run in background mode it creates a PID file in 'cache//instasent_resque_scheduledworker.pid'. If you clear your cache while the scheduledworker is running you won't be able to stop it with the scheduledworker-stop command.

Alternatively, you can run the scheduledworker in the foreground with the --foreground option.

Note also you should only ever have one scheduledworker running, and if the PID file already exists you will have to use the --force option to start a scheduledworker.

Manage production workers with supervisord

It's probably best to use supervisord (http://supervisord.org) to run the workers in production, rather than re-invent job spawning, monitoring, stopping and restarting.

Here's a sample conf file

(If you use a custom Resque prefix, add an extra environment variable: PREFIX='my-resque-prefix')

Then in Capifony you can do

sudo supervisorctl stop myapp:* before deploying your app and sudo supervisorctl start myapp:* afterwards.

More features

Changing the queue

You can change a job queue just by setting the queue field of the job:

From within the job:

Or from outside the job:

Access the container from inside your job

Just extend the ContainerAwareJob:

Stop a worker

Use the app/console instasent:resque:worker-stop command.

Auto retry

You can have the bundle auto retry failed jobs by adding retry strategy for either a specific job, or for all jobs in general:

The following will allow Some\Job to retry 3 times.

Setting strategy for all jobs:

With default strategy for all but specific jobs:

The default strategy (if provided) will be applied to all jobs that does not have a specific strategy attached. If not provided these jobs will not have auto retry.

You can disable auto_retry for selected jobs by using an empty array:

Here Some\Job will not have any auto_retry attached.

Please note

To use the auto_retry feature, you must also run the scheduler job:

app/console instasent:resque:scheduledworker-start


All versions of resque-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/framework-bundle Version >=2.0
chrisboulton/php-resque Version dev-master
symfony/polyfill-php70 Version ^1.0
chrisboulton/php-resque-scheduler Version dev-master
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package instasent/resque-bundle contains the following files

Loading the files please wait ....