Beanstalk\Command\Reserve Class Ref

class Beanstalk\Command\Reserve
Extends:Beanstalk\Command
Description:Reserve command
Author:Joshua Dechant <jdechant@shapeup.com>

This will return a newly-reserved job. If no job is available to be reserved, beanstalkd will wait to send a response until one becomes available. Once a job is reserved for the client, the client has limited time to run (TTR) the job before the job times out. When the job times out, the server will put the job back into the ready queue. Both the TTR and the actual time left can be found in response to the stats-job command.

A timeout value of 0 will cause the server to immediately return either a response or TIMED_OUT. A positive value of timeout will limit the amount of time the client will block on the reserve request until a job becomes available.

Class Methods

Beanstalk\Command\Reserve::__construct([$timeout = null])
Description:

Constructor

Parameters:
  • $timeout (integer) – Wait timeout in seconds
Beanstalk\Command\Reserve::getCommand()
Description:Get the command to send to the beanstalkd server
Returns:string
Beanstalk\Command\Reserve::parseResponse($response[, $data = null, $conn = null])
Description:

Parse the response for success or failure.

Parameters:
  • $response (string) – Response line, i.e, first line in response
  • $data (string) – Data recieved with reponse, if any, else null
  • $conn (BeanstalkConnection) – BeanstalkConnection use to send the command
Returns:

BeanstalkJob

Throws:

BeanstalkException When trying to reserve another job and the TTR of the current job ends soon

Throws:

BeanstalkException When the wait timeout exceeded before a job became available

Throws:

BeanstalkException When any other error occurs

Beanstalk\Command\Reserve::returnsData()
Description:Does the command return data?
Returns:boolean