Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#Codeigniter-jobQueue
###Job Queue based on redis and mcurl
# Codeigniter-jobQueue
### Job Queue based on redis and mcurl
by [Marcos Sanz](http://www.mistersanz.com)

Feel free to send me an email if you have any problems or you find bugs.

##Installation
## Installation
First of all, you have to install [codeigniter-redis](http://github.com/joelcox/codeigniter-redis) library, and [codeigniter-mcurl](http://github.com/chadhutchins/codeigniter-mcurl) library.
Just copy the files from this package to the correspoding folder in your
application folder. For example, /application/libraries/jobs.php.

###Loading library
### Loading library
In /application/config/autoload.php

$autoload['libraries'] = array('jobs');
Expand All @@ -18,7 +18,7 @@ or

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

##Application Usage
## 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
Expand All @@ -29,7 +29,7 @@ Variables:
* $belongTo ($user_id) => Id user from the job (Default: null).
* $stat => Jobs stats. For example: delayed, waiting, running, complete and failed

###Create new job
### Create new job
Function:

create($queue, $controller, $method, $params, $description, $belongTo)
Expand All @@ -38,7 +38,7 @@ For example:

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

###Create new schedule job
### Create new schedule job
Function:

create_at($at, $queue, $controller, $method, $params, $description, $belongTo)
Expand All @@ -47,7 +47,7 @@ For example:

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

###Get size from a given queue
### Get size from a given queue
Function:

get_queue_size($queue)
Expand All @@ -56,7 +56,7 @@ For example:

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

###Get size from the delayed queue
### Get size from the delayed queue
Function:

get_delayed_queue_size()
Expand All @@ -65,7 +65,7 @@ For example:

$this -> jobs -> get_delayed_queue_size();

###Get size from the delated queue in a given timestamp
### Get size from the delated queue in a given timestamp
Function:

get_delayed_timestamp_size($timestamp)
Expand All @@ -74,7 +74,7 @@ For example:

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

###Clear a queue
### Clear a queue
Function:

clear($queue)
Expand All @@ -83,7 +83,7 @@ For example:

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

###Destroy a queue
### Destroy a queue
Function:

destroy($queue)
Expand All @@ -92,13 +92,13 @@ For example:

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

###Remove a job
### Remove a job
Function:

//TODO


###Get peek from a given queue
### Get peek from a given queue
Function:

peek($queue)
Expand All @@ -107,7 +107,7 @@ For example:

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

###Get queues memebers
### Get queues memebers
Function:

queues()
Expand All @@ -116,7 +116,7 @@ For example:

$this -> jobs -> queues();

###Get workers and current job in the worker
### Get workers and current job in the worker
Function:

get_workers()
Expand All @@ -125,7 +125,7 @@ For example:

$this -> jobs -> get_workers();

###Get jobs statuses or get jobs statuses from a user
### Get jobs statuses or get jobs statuses from a user
Function:

get_statuses_jobs($user_id)
Expand All @@ -134,7 +134,7 @@ For example:

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

###Get number of stats from a given stat
### Get number of stats from a given stat
Function:

get_stat($stat)
Expand All @@ -143,7 +143,7 @@ For example:

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

###Clear stat
### Clear stat
Function:

clear_stat()
Expand All @@ -158,12 +158,12 @@ Variables:
* $queues => Name of the queues. For example: high
* $interval => Seconds to sleep worker (Default: null)

###Main worker (Execute jobs)
### Main worker (Execute jobs)
Function:

worker($worker_name, $queues, $interval)

###Delayed worker (Re-organize schedule jobs)
### Delayed worker (Re-organize schedule jobs)
Function:

worker_delayed($worker_name, $interval)
Expand Down