@@ -97,12 +97,12 @@ Jobs are queued as follows:
9797
9898``` php
9999// Required if redis is located elsewhere
100- Resque::setBackend('localhost:6379');
100+ Resque\Resque ::setBackend('localhost:6379');
101101
102102$args = array(
103103 'name' => 'Chris'
104104 );
105- Resque::enqueue('default', 'My_Job', $args);
105+ Resque\Resque ::enqueue('default', 'My_Job', $args);
106106```
107107
108108### Defining Jobs
@@ -157,24 +157,24 @@ This method can be used to conveniently remove a job from a queue.
157157
158158``` php
159159// Removes job class 'My_Job' of queue 'default'
160- Resque::dequeue('default', ['My_Job']);
160+ Resque\Resque ::dequeue('default', ['My_Job']);
161161
162162// Removes job class 'My_Job' with Job ID '087df5819a790ac666c9608e2234b21e' of queue 'default'
163- Resque::dequeue('default', ['My_Job' => '087df5819a790ac666c9608e2234b21e']);
163+ Resque\Resque ::dequeue('default', ['My_Job' => '087df5819a790ac666c9608e2234b21e']);
164164
165165// Removes job class 'My_Job' with arguments of queue 'default'
166- Resque::dequeue('default', ['My_Job' => array('foo' => 1, 'bar' => 2)]);
166+ Resque\Resque ::dequeue('default', ['My_Job' => array('foo' => 1, 'bar' => 2)]);
167167
168168// Removes multiple jobs
169- Resque::dequeue('default', ['My_Job', 'My_Job2']);
169+ Resque\Resque ::dequeue('default', ['My_Job', 'My_Job2']);
170170```
171171
172172If no jobs are given, this method will dequeue all jobs matching the provided
173173queue.
174174
175175``` php
176176// Removes all jobs of queue 'default'
177- Resque::dequeue('default');
177+ Resque\Resque ::dequeue('default');
178178```
179179
180180### Tracking Job Statuses
@@ -184,27 +184,27 @@ status information will allow you to check if a job is in the queue, is
184184currently being run, has finished, or has failed.
185185
186186To track the status of a job, pass ` true ` as the fourth argument to
187- ` Resque::enqueue ` . A token used for tracking the job status will be returned:
187+ ` Resque\Resque ::enqueue ` . A token used for tracking the job status will be returned:
188188
189189``` php
190- $token = Resque::enqueue('default', 'My_Job', $args, true);
190+ $token = Resque\Resque ::enqueue('default', 'My_Job', $args, true);
191191echo $token;
192192```
193193
194194To fetch the status of a job:
195195
196196``` php
197- $status = new Resque_Job_Status ($token);
197+ $status = new Resque\Job\Status ($token);
198198echo $status->get(); // Outputs the status
199199```
200200
201- Job statuses are defined as constants in the ` Resque_Job_Status ` class. Valid
201+ Job statuses are defined as constants in the ` Resque\Job\Status ` class. Valid
202202statuses include:
203203
204- - ` Resque_Job_Status ::STATUS_WAITING` - Job is still queued
205- - ` Resque_Job_Status ::STATUS_RUNNING` - Job is currently running
206- - ` Resque_Job_Status ::STATUS_FAILED` - Job has failed
207- - ` Resque_Job_Status ::STATUS_COMPLETE` - Job is complete
204+ - ` Resque\Job\Status ::STATUS_WAITING` - Job is still queued
205+ - ` Resque\Job\Status ::STATUS_RUNNING` - Job is currently running
206+ - ` Resque\Job\Status ::STATUS_FAILED` - Job has failed
207+ - ` Resque\Job\Status ::STATUS_COMPLETE` - Job is complete
208208- ` false ` - Failed to fetch the status; is the token valid?
209209
210210Statuses are available for up to 24 hours after a job has completed or failed,
@@ -213,13 +213,13 @@ calling the `stop()` method on a status class.
213213
214214### Obtaining job PID ###
215215
216- You can obtain the PID of the actual process doing the work through ` Resque_Job_PID ` . On a forking OS this will be the
216+ You can obtain the PID of the actual process doing the work through ` Resque\Job\PID ` . On a forking OS this will be the
217217PID of the forked process.
218218
219219CAUTION: on a non-forking OS, the PID returned will be of the worker itself.
220220
221221``` php
222- echo Resque_Job_PID ::get($token);
222+ echo Resque\Job\PID ::get($token);
223223```
224224
225225Function returns ` 0 ` if the ` perform ` hasn't started yet, or if it has already ended.
@@ -231,12 +231,12 @@ To quote the documentation for the Ruby resque-scheduler:
231231> Delayed jobs are one-off jobs that you want to be put into a queue at some
232232 point in the future. The classic example is sending an email:
233233
234- require 'Resque/Resque .php';
235- require 'ResqueScheduler/ResqueScheduler .php';
234+ require 'Resque.php';
235+ require 'Scheduler .php';
236236
237237 $in = 3600;
238238 $args = array('id' => $user->id);
239- ResqueScheduler ::enqueueIn($in, 'email', 'SendFollowUpEmail', $args);
239+ Resque\Scheduler ::enqueueIn($in, 'email', 'SendFollowUpEmail', $args);
240240
241241The above will store the job for 1 hour in the delayed queue, and then pull the
242242job off and submit it to the ` email ` queue in Resque for processing as soon as
@@ -246,14 +246,14 @@ Instead of passing a relative time in seconds, you can also supply a timestamp
246246as either a DateTime object or integer containing a UNIX timestamp to the
247247` enqueueAt ` method:
248248
249- require 'Resque/Resque .php';
250- require 'ResqueScheduler/ResqueScheduler .php';
249+ require 'Resque.php';
250+ require 'Scheduler .php';
251251
252252 $time = 1332067214;
253- ResqueScheduler ::enqueueAt($time, 'email', 'SendFollowUpEmail', $args);
253+ Resque\Scheduler ::enqueueAt($time, 'email', 'SendFollowUpEmail', $args);
254254
255255 $datetime = new DateTime('2012-03-18 13:21:49');
256- ResqueScheduler ::enqueueAt($datetime, 'email', 'SendFollowUpEmail', $args);
256+ Resque\Scheduler ::enqueueAt($datetime, 'email', 'SendFollowUpEmail', $args);
257257
258258NOTE: resque-scheduler does not guarantee a job will fire at the time supplied.
259259At the time supplied, resque-scheduler will take the job out of the delayed
@@ -426,11 +426,11 @@ It's easy to start the resque-scheduler worker using `bin/resque-scheduler`:
426426php-resque has a basic event system that can be used by your application to
427427customize how some of the php-resque internals behave.
428428
429- You listen in on events (as listed below) by registering with ` Resque_Event ` and
429+ You listen in on events (as listed below) by registering with ` Resque\Event ` and
430430supplying a callback that you would like triggered when the event is raised:
431431
432- ``` sh
433- Resque_Event ::listen(' eventName' , [callback]);
432+ ``` php
433+ Resque\Event ::listen('eventName', [callback]);
434434```
435435
436436` [callback] ` may be anything in PHP that is callable by ` call_user_func_array ` :
@@ -443,12 +443,12 @@ Resque_Event::listen('eventName', [callback]);
443443Events may pass arguments (documented below), so your callback should accept
444444these arguments.
445445
446- You can stop listening to an event by calling ` Resque_Event ::stopListening` with
447- the same arguments supplied to ` Resque_Event ::listen` .
446+ You can stop listening to an event by calling ` Resque\Event ::stopListening` with
447+ the same arguments supplied to ` Resque\Event ::listen` .
448448
449449It is up to your application to register event listeners. When enqueuing events
450450in your application, it should be as easy as making sure php-resque is loaded
451- and calling ` Resque_Event ::listen` .
451+ and calling ` Resque\Event ::listen` .
452452
453453When running workers, if you run workers via the default ` bin/resque ` script,
454454your ` APP_INCLUDE ` script should initialize and register any listeners required
@@ -462,20 +462,20 @@ A sample plugin is included in the `extras` directory.
462462#### beforeFirstFork
463463
464464Called once, as a worker initializes. Argument passed is the instance of
465- ` Resque_Worker ` that was just initialized.
465+ ` Resque\Worker\ResqueWorker ` that was just initialized.
466466
467467#### beforeFork
468468
469469Called before php-resque forks to run a job. Argument passed contains the
470- instance of ` Resque_Job ` for the job about to be run.
470+ instance of ` Resque\JobHandler ` for the job about to be run.
471471
472472` beforeFork ` is triggered in the ** parent** process. Any changes made will be
473473permanent for as long as the ** worker** lives.
474474
475475#### afterFork
476476
477477Called after php-resque forks to run a job (but before the job is run). Argument
478- passed contains the instance of ` Resque_Job ` for the job about to be run.
478+ passed contains the instance of ` Resque\JobHandler ` for the job about to be run.
479479
480480` afterFork ` is triggered in the ** child** process after forking out to complete
481481a job. Any changes made will only live as long as the ** job** is being
@@ -484,16 +484,16 @@ processed.
484484#### beforePerform
485485
486486Called before the ` setUp ` and ` perform ` methods on a job are run. Argument
487- passed contains the instance of ` Resque_Job ` for the job about to be run.
487+ passed contains the instance of ` Resque\JobHandler ` for the job about to be run.
488488
489489You can prevent execution of the job by throwing an exception of
490- ` Resque_Job_DontPerform ` . Any other exceptions thrown will be treated as if they
490+ ` Resque\Exceptions\DoNotPerformException ` . Any other exceptions thrown will be treated as if they
491491were thrown in a job, causing the job to fail.
492492
493493#### afterPerform
494494
495495Called after the ` perform ` and ` tearDown ` methods on a job are run. Argument
496- passed contains the instance of ` Resque_Job ` that was just run.
496+ passed contains the instance of ` Resque\JobHandler ` that was just run.
497497
498498Any exceptions thrown will be treated as if they were thrown in a job, causing
499499the job to be marked as having failed.
@@ -503,11 +503,11 @@ the job to be marked as having failed.
503503Called whenever a job fails. Arguments passed (in this order) include:
504504
505505- Exception - The exception that was thrown when the job failed
506- - Resque_Job - The job that failed
506+ - Resque\JobHandler - The job that failed
507507
508508#### beforeEnqueue
509509
510- Called immediately before a job is enqueued using the ` Resque::enqueue ` method.
510+ Called immediately before a job is enqueued using the ` Resque\Resque ::enqueue ` method.
511511Arguments passed (in this order) include:
512512
513513- Class - string containing the name of the job to be enqueued
@@ -516,11 +516,11 @@ Arguments passed (in this order) include:
516516- ID - string containing the token of the job to be enqueued
517517
518518You can prevent enqueing of the job by throwing an exception of
519- ` Resque_Job_DontCreate ` .
519+ ` Resque\Exceptions\DoNotCreateException ` .
520520
521521#### afterEnqueue
522522
523- Called after a job has been queued using the ` Resque::enqueue ` method. Arguments
523+ Called after a job has been queued using the ` Resque\Resque ::enqueue ` method. Arguments
524524passed (in this order) include:
525525
526526- Class - string containing the name of scheduled job
0 commit comments