Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bigcommerce/php-resque-pause
An addon for php-resque, php-resque-pause adds functionality to pause resque jobs.
https://github.com/bigcommerce/php-resque-pause
Last synced: 3 days ago
JSON representation
An addon for php-resque, php-resque-pause adds functionality to pause resque jobs.
- Host: GitHub
- URL: https://github.com/bigcommerce/php-resque-pause
- Owner: bigcommerce
- License: mit
- Created: 2014-09-19T11:46:55.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-29T05:35:30.000Z (about 8 years ago)
- Last Synced: 2024-09-15T18:55:22.317Z (about 2 months ago)
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 5
- Watchers: 87
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PHP Resque Pause [![Build Status](https://travis-ci.org/bigcommerce/php-resque-pause.svg?branch=master)](https://travis-ci.org/bigcommerce/php-resque-pause)
==================================A [PHP-Resque](http://github.com/chrisboulton/php-resque) plugin.
resque-pause adds functionality to pause resque jobs
Using a pause allows you to stop the worker without stop the enqueue
For further information re: php-resque, visit this official repo:
## Requirements ##
* PHP 5.3+
* Redis 2.2+
* Composer## Getting Started ##
resque-pause is installed via composer. To install:```bash
$ # Add php-resque-pause to your project's composer.json
$ composer require "bigcommerce/php-resque-pause"
$ # Install composer dependencies
$ composer install
```## Usage ##
To use Resque Pause in your application you'll need to create a globally used instance, we use Pimple but you can use
globals, a static variable, or whatever else you like. Upon instantiation `Pause` will add a Resque listener to make
sure that any jobs pushed to a paused queue will be paused as well. On destruction `Pause` will remove said listener.```php
// Let's put it in a global since that's easy/familiar
$GLOBALS['ResquePause'] = new \Resque\Plugins\Pause(); // Your enqueues are now being listened to
```### Pause it! ###
```php
$GLOBALS['ResquePause']->pause('My_Queue');
```### Resume it! ###
```php
$GLOBALS['ResquePause']->resume('My_Queue');
```### Is it Paused? ###
```php
$GLOBALS['ResquePause']->isPaused('My_Queue');
```## Contributing ##
This repo is fairly thoroughly tested so please add tests for any feature you add. We use PSR-4 conventions and have a
linter in place. To run the linter simply run `composer lint` and to run the tests locally run `composer test`. To have
your code reviewed please tag @bigcommerce-labs/tools.