Giter Site home page Giter Site logo

gabelimon / php-resque-pause Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bigcommerce/php-resque-pause

0.0 1.0 0.0 133 KB

An addon for php-resque, php-resque-pause adds functionality to pause resque jobs.

License: MIT License

PHP 100.00%

php-resque-pause's Introduction

php-resque-pause: PHP Resque Pause Build Status

A 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: http://github.com/chrisboulton/php-resque

Requirements

  • PHP 5.3+
  • Redis 2.2+
  • Composer

Getting Started

resque-pause is installed via composer. To install:

$ # 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.

// 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!

$GLOBALS['ResquePause']->pause('My_Queue');

Resume it!

$GLOBALS['ResquePause']->resume('My_Queue');

Is it Paused?

$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 @gabelimon and @wedy.

php-resque-pause's People

Contributors

wedy avatar gabelimon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.