Tube

This class models a tube within a Beanstalkd instance. There are two concepts associated with Tubes - watching and using. When you use a tube you alter the target tube that new jobs get added to. When you watch a tube you are indicating that you are interested in the jobs that have been added to it. You can only use a single tube at any one time but you can watch multiple tubes simultaneously.

Note that the Connection object associated with a Tube instance should not be shared with any other tubes. For this reason it's probably best practice to create Tube's directly using the constructor that takes a Server object as that will guarantee a new Connection for the Tube.

Constructors

this
this(Connection connection)

Constructor for the Tube class that creates a Tube object using the 'default' tube on the server.

this
this(Server server)

Constructor for the Tube class that creates a Tube object using the 'default' tube on the server. Use this method in preference to creating a Tube using a Connection object as this guarantees a Connection dedicated to the Tube.

Members

Functions

buryJob
void buryJob(uint jobId, uint priority)

This function buries a specified job. Note that you must have first reserved the job before you can bury it.

deleteJob
void deleteJob(uint jobId)

This function deletes a specific job from Beanstalk. Note that you must have reserved the job before you can delete it.

ignore
void ignore(string[] names)

This function removes one or more names from the server tubes that a Tube object watches.

kick
uint kick(uint maximum)

This function attempts to kick buried jobs. If there are buried jobs then Beanstalk will return them to a ready state. Failing that, if there are any delayed jobs they will be kicked instead.

kickJob
void kickJob(uint jobId)

This function kicks a specific job if it is sitting in the buried or delayed queues.

peek
Job peek()

This function 'peeks' at the Beanstalk ready queue to see if there is a job available. If there is a job is is returned. Note that peeking does not reserve the job returned.

peekBuried
Job peekBuried()

This function 'peeks' at the Beanstalk buried queue to see if there is a job available. If there is a job is is returned. Note that peeking does not reserve the job returned.

peekDelayed
Job peekDelayed()

This function 'peeks' at the Beanstalk delayed queue to see if there is a job available. If there is a job is is returned. Note that peeking does not reserve the job returned.

peekForId
Job peekForId(uint jobId)

This function peeks at Beanstalks contents to see if a job with a given id exists. If it does it is returned. Note that peeking does not reserve the job returned.

put
void put(Job job, uint delay, uint priority, uint timeToRun)

This function adds a new job to the tube that is currently being used.

releaseJob
void releaseJob(uint jobId, uint delay, uint priority)

This function releases a previously reserved job back to Beanstalk control.

reserve
Job reserve()

A blocking implementation of the reserve() method that will not return until such time as a Job is available or an exception occurs.

reserve
Nullable!Job reserve(uint timeOut)

This function attempts to reserve a job from one of the tubes that a Tube object is currently watching. Note that the return type for the function is a Nullable!Job. This value will test as null if a Job did not become available before the time out.

touchJob
void touchJob(uint jobId)

This function touches a job, extending its time to run on the server. Note that you must have first reserved the job before you can touch it.

use
void use(string name)

This function alters the server tube that a Tube object uses.

watch
void watch(string[] names)

This function adds to the server tubes that a Tube object watches.

Properties

connection
Connection connection [@property getter]

Getter for the connection property.

using
string using [@property getter]

This function retrieves a string containing the name of the tube that the Tube object is currently using.

using
string using [@property setter]

This function is simply an alias for a call to the use() function.

watching
string[] watching [@property getter]

This function returns a list of the name for the tubes that the Tube object is currently watching.

Static variables

DEFAULT_TUBE_NAME
auto DEFAULT_TUBE_NAME;

The name of the default tube if an explicit tube is not used.

MAX_TUBE_NAME_LEN
auto MAX_TUBE_NAME_LEN;

The maximum length permitted for a tube name.

Meta