Create the client.
The optional readTimeoutMs parameter allows you to specify how long the client will wait for data from the Beanstalk server before timing out.
This should be greater than the maximum time spent waiting for a job with "reserve()" or "reserveWithTimeout()".
The maximum number of milliseconds to wait when reading from the server.
Put a job into the "buried" state.
The job will remain in this state until released with the "kick" command.
The ID of the job to bury.
The job's priority within the buried queue.
Returns a promise that resolves when the command is complete.
Close the connection to the server.
Returns a promise that resolves when the connection is closed.
Connect to the Beanstalk server.
The server's hostname or IP address.
The TCP/IP port number.
Returns a promise that resolves when the connection is ready or rejects if connecting fails.
Delete a job from the queue.
This should be called after reserving and successfully processing a job.
The ID of the job to delete.
Returns a promise that resolves when the command is complete.
Change buried or delayed jobs in the currently used queue to be ready.
If there are any buried jobs then only buried jobs will be affected, otherwise, only delayed jobs will be affected.
The maximum number of jobs to alter.
Returns a promise that resolves to the number of jobs set to ready.
Change a specific job from buried or delayed to ready.
The ID of the job to modify.
Returns a promise that resolves when the job has been updated. Rejects with "NOT_FOUND" if there was no job with the given ID.
List all the tubes on the server.
Returns a promise that resolves to an array of tube names.
Delay any new jobs from being reserved.
The tube to pause.
The number of seconds for which to pause.
Returns a promise that resolves when the command is complete.
Inspect a specific job.
The ID of the job to inspect.
Returns a promise that resolves to the job or null if there is none.
Inspect the first buried job.
Returns a promise that resolves to the job or null if there is none.
Inspect the first delayed job.
Returns a promise that resolves to the job or null if there is none.
Inspect the first ready job.
Returns a promise that resolves to the job or null if there is none.
Add a job to the currently used queue.
The job to enqueue.
The integer job priority between 0 and 2^32-1. Jobs with lower priority values will be reserved before jobs with higher priority values.
The maximum number of seconds a job may be reserved for before being returned to the queue.
The number of seconds to wait between accepting the job and making it available to be reserved.
Returns a promise that resolves to the job ID.
Instruct the Beanstalk server to close the connection.
Note that the Beanstlk server will close the connection immediately upon receiving this command. It will not wait for the output from any previous commands to be sent. You should therefore wait for any in-progress commands to be completed before issuing the quit command.
Returns a promise that resolves when the command is complete.
Return the job to the "ready" state.
This can be used to put a job back into the queue if processing fails.
The ID of the job to release.
The job's new priority.
The number of seconds to wait before marking the job as ready.
Returns a promise that resolves when the command is complete.
Read a job from the queue.
Returns a promise that resolves to the first job that was ready in any of the watched queues.
Read a job from the queue.
Returns a promise that resolves to the first job that was ready in any of the watched queues, or null if there were no jobs within the timeout.
Fetch statistics about the server.
Returns a promise that resolves to a map of data about the server.
Fetch statistics about a specific job.
The ID of the job to query.
Returns a promise that resolves to a map of data about the job.
Fetch statistics about a tube.
The name of the tube to query.
Returns a promise that resolves to a map of data about the tube.
Request more time working on a job.
The job's time to
The ID of the job to touch.
Returns a promise that resolves when the command is complete.
Set the tube into which new jobs will be placed.
The name of the tube.
Returns a promise that resolves when the command is complete.
Watch a tube for incoming jobs.
After calling watch(), call reserve() to wait for a job to be ready.
This may be called multiple times to watch multipe tubes at once.
The name of the tube to watch.
Returns a promise that resolves to the number of tubes being watched.
The Client connects to the Beanstalk server and allows you to send commands and receive responses.