Beanstalk\
Job
¶Description: | A Beanstalkd job |
---|---|
Author: | Joshua Dechant <jdechant@shapeup.com> |
Class Methods
Job::__construct
– ConstructorJob::bury
– Bury the jobJob::delete
– Delete the jobJob::getConnection
– Get the beanstalkd connection for the jobJob::getId
– Get the job idJob::getMessage
– Get the job body/messageJob::release
– Release the jobJob::stats
– Get stats on the jobJob::touch
– Touch the jobBeanstalk\Job::
__construct
($conn, $id, $message)¶Description: | Constructor |
---|---|
Parameters: |
|
Beanstalk\Job::
bury
([$priority = 2048])¶Description: | Bury the job |
---|---|
Parameters: |
|
The bury command puts a job into the “buried” state. Buried jobs are put into a FIFO linked list and will not be touched by the server again until a client kicks them with the “kick” command.
Beanstalk\Job::
delete
()¶Description: | Delete the job |
---|---|
Returns: | boolean |
Throws: | BeanstalkException |
The delete command removes a job from the server entirely. It is normally used by the client when the job has successfully run to completion.
Beanstalk\Job::
getConnection
()¶Description: | Get the beanstalkd connection for the job |
---|---|
Returns: | BeanstalkConnection |
Beanstalk\Job::
getId
()¶Description: | Get the job id |
---|---|
Returns: | integer |
Beanstalk\Job::
getMessage
()¶Description: | Get the job body/message |
---|---|
Returns: | mixed String of body for simple message; stdClass for JSON messages |
Beanstalk\Job::
release
([$delay = 10, $priority = 5])¶Description: | Release the job |
---|---|
Parameters: |
|
Returns: | boolean |
Throws: | BeanstalkException |
The release command puts a reserved job back into the ready queue (and marks its state as “ready”) to be run by any client. It is normally used when the job fails because of a transitory error.
Beanstalk\Job::
stats
()¶Description: | Get stats on the job |
---|---|
Returns: | BeanstalkStats |
Throws: | BeanstalkException When the job does not exist |
The stats-job command gives statistical information about the specified job if it exists.
Beanstalk\Job::
touch
()¶Description: | Touch the job |
---|---|
Returns: | boolean |
Throws: | BeanstalkException |
The “touch” command allows a worker to request more time to work on a job. This is useful for jobs that potentially take a long time, but you still want the benefits of a TTR pulling a job away from an unresponsive worker. A worker may periodically tell the server that it’s still alive and processing a job (e.g. it may do this on DEADLINE_SOON).