Skip to content

mvdriel/cakephp-queue

 
 

Repository files navigation

Queue plugin for CakePHP

Build Status PHP 7 ready Coverage Status Packagist downloads Code Climate

Requirements

  • CakePHP 2.6.0 or greater.
  • PHP 5.4.16 or greater.

Installation

Clone/Copy the files in this directory into app/Plugin/Queue

Configuration

Ensure the plugin is loaded in app/Config/bootstrap.php by calling:

CakePlugin::load('Queue');

Ensure to configure the following lines in app/Config/bootstrap.php:

Configure::write('Queue.workers', 3);
Configure::write('Queue.sleepTime', 10);
Configure::write('Queue.gcprop', 10);
Configure::write('Queue.defaultWorkerTimeout', 2 * MINUTE);
Configure::write('Queue.defaultWorkerRetries', 4);
Configure::write('Queue.workerMaxRuntime', 0);
Configure::write('Queue.cleanupTimeout', DAY);
Configure::write('Queue.exitWhenNothingToDo', false);

Load schema:

Console/cake schema create;

Usage

Console

Run from your APP folder:

# Tries to call the `add()` function on a task.
Console/cake Queue.queue add <taskname>;
# Run a queue worker.
Console/cake Queue.queue runworker;
# Display some general statistics.
Console/cake Queue.queue stats;
# Manually call cleanup function to delete task data of completed tasks.
Console/cake Queue.queue clean;
# Manually call cleanup_failed function to delete task data of failed tasks.
Console/cake Queue.queue clean_failed;

About

A minimalistic Queue Plugin for CakePHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%