2017 © Pedro Peláez
 

library codeigniter-job-queue-redis

Job Queue based on redis

image

genius13/codeigniter-job-queue-redis

Job Queue based on redis

  • Tuesday, September 16, 2014
  • by marsanla
  • Repository
  • 9 Watchers
  • 50 Stars
  • 67 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 28 Forks
  • 4 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Codeigniter-jobQueue

Job Queue based on redis and mcurl

by Marcos Sanz, (*1)

Feel free to send me an email if you have any problems or you find bugs., (*2)

Installation

First of all, you have to install codeigniter-redis library, and codeigniter-mcurl library. Just copy the files from this package to the correspoding folder in your application folder. For example, /application/libraries/jobs.php., (*3)

Loading library

In /application/config/autoload.php, (*4)

$autoload['libraries'] = array('jobs');

or, (*5)

$this -> load -> library('jobs');

Application Usage

Variables: * $at ($timestamp) => Unix timestamp when you want to execute the job * $queue => Name of the queue. For example: high, normal, low, mail, archive * $controller => Name of the controller * $method => Name of the method from controller (Default: index) * $params => Array of params (Default: null). For example: array('param1','param2','param3') * $description => Description of the task (Default: null). For example: UpdateUserProfile * $belongTo ($user_id) => Id user from the job (Default: null). * $stat => Jobs stats. For example: delayed, waiting, running, complete and failed, (*6)

Create new job

Function:, (*7)

create($queue, $controller, $method, $params, $description, $belongTo)

For example:, (*8)

$this -> jobs -> create('high', 'users', 'check_users', array('10'), 'checkUsers','1');

Create new schedule job

Function:, (*9)

create_at($at, $queue, $controller, $method, $params, $description, $belongTo)

For example:, (*10)

$this -> jobs -> create_at(1353456000, 'high', 'users', 'check_users', array('10'), 'checkUsers','1');

Get size from a given queue

Function:, (*11)

get_queue_size($queue)

For example:, (*12)

$this -> jobs -> get_queue_size('low');

Get size from the delayed queue

Function:, (*13)

get_delayed_queue_size()

For example:, (*14)

$this -> jobs -> get_delayed_queue_size();

Get size from the delated queue in a given timestamp

Function:, (*15)

get_delayed_timestamp_size($timestamp)

For example:, (*16)

$this -> jobs -> get_delayed_timestamp_size(1353456000);

Clear a queue

Function:, (*17)

clear($queue)

For example:, (*18)

$this -> jobs -> clear('low');

Destroy a queue

Function:, (*19)

destroy($queue)

For example:, (*20)

$this -> jobs -> destroy('low');

Remove a job

Function:, (*21)

//TODO

Get peek from a given queue

Function:, (*22)

peek($queue)

For example:, (*23)

$this -> jobs -> peek('low');

Get queues memebers

Function:, (*24)

queues()

For example:, (*25)

$this -> jobs -> queues();

Get workers and current job in the worker

Function:, (*26)

get_workers()

For example:, (*27)

$this -> jobs -> get_workers();

Get jobs statuses or get jobs statuses from a user

Function:, (*28)

get_statuses_jobs($user_id)

For example:, (*29)

$this -> jobs -> get_statuses_jobs(); or $this -> jobs -> get_statuses_jobs(2341);

Get number of stats from a given stat

Function:, (*30)

get_stat($stat)

For example:, (*31)

$this -> jobs -> get_stat('running');

Clear stat

Function:, (*32)

clear_stat()

For example:, (*33)

$this -> jobs -> clear_stat();

Worker Usage

Variables: * $worker_name => Name of the machine or worker (Default: worker) * $queues => Name of the queues. For example: high * $interval => Seconds to sleep worker (Default: null), (*34)

Main worker (Execute jobs)

Function:, (*35)

worker($worker_name, $queues, $interval)

Delayed worker (Re-organize schedule jobs)

Function:, (*36)

worker_delayed($worker_name, $interval)

Thanks,
-Marcos Sanz
marcossanzlatorre@gmail.com
@marsanla, (*37)

The Versions

16/09 2014

dev-master

9999999-dev https://github.com/marsanla/Codeigniter-jobQueue

Job Queue based on redis

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

redis queue job

16/09 2014

0.1

0.1.0.0 https://github.com/marsanla/Codeigniter-jobQueue

Job Queue based on redis

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

redis queue job