mcfedr / resque-queue-driver-bundle
A bundle for running symfony background tasks with Redis backend
Installs: 2 817
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 3
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.5
- mcfedr/php-resque: ~1.3
- mcfedr/php-resque-scheduler: ~1.4
- mcfedr/queue-manager-bundle: ^5.4.5
- symfony/framework-bundle: ^3.0|^4.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.1
- phpunit/phpunit: ^4.1|^5.7
- symfony/browser-kit: ^3.4|^4.0
- symfony/monolog-bundle: ^2.8|^3.0
Suggests
- ext-redis: Improve performance using redis
README
A driver for Queue Manager Bundle that uses resque
Usage
PHP Resque installs two commands into your bin folder.
Generally you should run just one instance of resque-scheduler
and several of resque
.
QUEUE=default APP_INCLUDE=var/bootstrap.php.cache REDIS_BACKEND=127.0.0.1:6379 ./vendor/bin/resque
PREFIX="my_app:" REDIS_BACKEND=127.0.0.1:6379 ./vendor/bin/resque-scheduler
- Add
VVERBOSE=1
to the environment to get more logging.
It can be useful to decouple the queueing (master) and execution (slave) of jobs in a
micro service architecture. For this it can be necessary to set specific kernel_options
for a worker if they differ from the master.
- Add
KERNEL_CLASS
with the fully qualified class name of the kernel to override thekernel.root_dir
option. If your kernel is not located in the root namespace (like in symfony flex applications), this is the only way to specify the class name of the kernel class. - Add
SYMFONY_ENV
orAPP_ENV
to override thekernel.environment
option. - Add
SYMFONY_DEBUG
orAPP_DEBUG
to override thekernel.debug
option.
Install
Composer
composer require mcfedr/resque-queue-driver-bundle
AppKernel
Include the bundle in your AppKernel
public function registerBundles()
{
$bundles = [
...
new Mcfedr\QueueManagerBundle\McfedrQueueManagerBundle(),
new Mcfedr\ResqueQueueDriverBundle\McfedrResqueQueueDriverBundle(),
Config
With this bundle installed you can setup your queue manager config similar to this:
mcfedr_queue_manager:
managers:
default:
driver: resque
options:
host: 127.0.0.1
port: 11300
default_queue: default
track_status: false
This will create a QueueManager
service named "mcfedr_queue_manager.default"
host
andport
- Where is your Redis serverdefault_queue
- Name of the default queue to usetrack_status
- Set totrue
to enable extra job tracking data to be stored in redis. Useful for debugging
Options to QueueManager::put
queue
- Astring
with the name of a queuetime
- A\DateTime
object of when to schedule this jobdelay
- Number of seconds from now to schedule this jobtrack_status
- Set totrue
to enable extra job tracking data to be stored in redis. Useful for debugging