0.3.7 • Published 4 years ago

@beanstalk/core v0.3.7

Weekly downloads
14
License
MIT
Repository
github
Last release
4 years ago

@beanstalk/core

build | npm

Documentation

A 0 dependency, full-featured, battle-tested beanstalk client library.

NOTE
While version is lower than v1.0.0 the API might change slightly

Installation

yarn add @beanstalk/core

Usage

PUT

import { BeanstalkClient } from '@beanstalk/core';

/**
 * Usage: node put.js
 */
async function main() {
  const client = new BeanstalkClient();
  await client.connect(); // defaults to localhost:11300

  const id = await client.put('Hello World');
  console.log(`Job created with '${id}'`);

  client.quit();
}

main().catch((err) => {
  console.error(err.message);
  process.exit(1);
});

RESERVE

import { BeanstalkClient } from '@beanstalk/core';

/**
 * Usage: node reserve.js > out
 */
async function main() {
  const client = new BeanstalkClient();
  await client.connect(); // defaults to localhost:11300

  await client.watch('my-tube');
  await client.ignore('default'); // 'default' is watched by default

  // hangs until a job gets ready on 'my-tube'
  const [id, payload] = await client.reserve();
  console.error(`Job ID: ${id}`);
  await new Promise((resolve, reject) => {
    process.stdout.write(payload, (err) => err ? reject(err) : resolve());
  });

  client.quit();
}

main().catch((err) => {
  console.error(err.message);
  process.exit(1);
});
0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.2

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.2

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago