class Beanstalk::Tube
- Beanstalk::Tube
- Reference
- Object
Overview
This class represents a Beanstalk tube.
Defined in:
Constant Summary
-
DEFAULT_QUEUE_NAME =
"default"
-
Constant for the default tube name.
-
MAX_NAME_LEN =
200
-
Constant for the maximum tube name length.
-
VALID_NAME_PATTERN =
/^[A-Za-z0-9_\-\+;\$\/\.\(\)]{1,200}$/
-
A constant for the valid name pattern.
Constructors
Class Method Summary
-
.valid_tube_name?(name : String)
A method to check whether a given string is a valid tube name.
Instance Method Summary
-
#bury(job : Job, priority : UInt32 = Job::Settings::DEFAULT_PRIORITY)
Buries the specified job.
-
#bury(job_id, priority : UInt32 = Job::Settings::DEFAULT_PRIORITY)
Buries the job by its id.
-
#connection : Beanstalk::Connection
Retrieves the connection associated with the Tube.
-
#delete(job_id : Int64?)
Deletes a job from Beanstalk based on the job id.
-
#delete(job : Job)
Deletes a Job from Beanstalk.
-
#delete?(job : Job)
Attempts to delete the Job passed in.
-
#empty!
This method will reserve and delete every job that it can from a Tube and will not return until it tries to reserve a job and receives nil back.
-
#ignore(name : String)
This method instructs a Tube to stop watching a named queue for content.
-
#kick(maximum : UInt32)
This method instructs the server to kick buried jobs to the ready queue.
-
#kick_job(job : Job)
This method instructs the server to kick a specific job from the buried state (if it is buried) to the ready state.
-
#kick_job(job_id)
This method instructs the server to kick a specific job from the buried state (if it is buried) to the ready state.
-
#peek(state : JobState)
Fetches details for a job, if one is available, without actually reserving it.
-
#put(job : Job, settings : Job::Settings? = nil)
This method puts a Job into the queue currently being used by the Tube.
-
#release(job_id : Int | String, settings : Job::Settings? = nil)
This method releases a Job that had previously been reserved, returning it to the ready list and making it available to be reserved again.
-
#release(job : Job, settings : Job::Settings? = nil)
This method releases a Job that had previously been reserved, returning it to the ready list and making it available to be reserved again.
-
#reserve(time_out : Time::Span) : Job?
Attempts to reserve a Job from a Tube.
-
#reserve(job_id)
Reserves a job from a Tube based on it's id.
-
#reserve : Job
Attempts to reserve a job from a Tube, blocking until one becomes available.
-
#reserve?(job_id) : Job?
Reserves a job from a Tube based on it's id.
-
#reserve?
This method is equivalent to calling the reserve method with a time out of zero.
-
#stats(job_id : Int | String)
This method fetches information relating to a specific job.
-
#stats(job : Job)
This method fetches information relating to a specific job.
-
#stats
This method fetches stats for the queue being used by a tube.
-
#touch(job_id : Int | String)
Touches the specified job, extending it's current time to run.
-
#touch(job : Job)
Touches the specified job, extending it's current time to run.
-
#use(name : String)
Instructs a Tube to use a given queue name, supplanting the previously used name.
-
#using : String
Retrieves the name of the queue the Tube is using.
-
#watch(name : String)
Instructs a tube to watch a named queue for content.
-
#watching : Array(String)
Retrieves an array of the names of the queues the Tube is watching.
Constructor Detail
Constructor. Preferrably you should simple obtain your Tube instances from a Connection instance rather than direct instantiating them. Creates a Tube object set to use and watch the queue name passed in. If the queue name differs from the default then the Tube created will still be watching the default queue too.
Class Method Detail
A method to check whether a given string is a valid tube name.
Instance Method Detail
Buries the specified job. Buried jobs are not part of the ready jobs list and therefore cannot be reserved. To unbury a job kick it.
Buries the job by its id. Buried jobs are not part of the ready jobs list and therefore cannot be reserved. To unbury a job kick it.
Deletes a job from Beanstalk based on the job id. Returns true upon successful completion. Raises an exception if the job id is invalid.
Deletes a Job from Beanstalk. Note the Job passed in must have an id or an exception will be raised. Returns true upon successful completion.
Attempts to delete the Job passed in. If the Job has no id then the method simply returns false, otherwise it makes a call to delete() using the specified job.
This method will reserve and delete every job that it can from a Tube and will not return until it tries to reserve a job and receives nil back. This method returns the number of jobs deleted from the queue.
This method instructs a Tube to stop watching a named queue for content.
This method instructs the server to kick buried jobs to the ready queue. No more than maximum jobs will be kicked by the server. If you specify a maximum of zero then the method will automatical assume a maximum of one. If successful the method returns the actual number of jobs that were kicked.
This method instructs the server to kick a specific job from the buried state (if it is buried) to the ready state. The method returns a boolean to indicate whether the kick request was successful.
This method instructs the server to kick a specific job from the buried state (if it is buried) to the ready state. The method returns a boolean to indicate whether the kick request was successful.
Fetches details for a job, if one is available, without actually reserving it. Note that you must stipulate the state of the job you would like to peek at.
This method puts a Job into the queue currently being used by the Tube.
This method releases a Job that had previously been reserved, returning it to the ready list and making it available to be reserved again. Note that, if job settings are specified, only the priority and delay are set when the job is released.
This method releases a Job that had previously been reserved, returning it to the ready list and making it available to be reserved again. Note that, if job settings are specified, only the priority and delay are set when the job is released.
Attempts to reserve a Job from a Tube. Takes an optional time_out parameter the indicates the mimimum number of seconds to wait for a Job to become available before giving up and returning nil.
Reserves a job from a Tube based on it's id. This method will raises an exception if the Job could not be found.
Reserves a job from a Tube based on it's id. This method will return nil if the Job could not be found.
This method is equivalent to calling the reserve method with a time out of zero. It should return immediately with either a Job or nil.
Instructs a Tube to use a given queue name, supplanting the previously used name. The queue name provided must be valid.
Instructs a tube to watch a named queue for content. If the named queue does not exist it will be created.