burstable / node-beanstalkd-client Goto Github PK
View Code? Open in Web Editor NEWA beanstalkd client for Node.js with promises
License: MIT License
A beanstalkd client for Node.js with promises
License: MIT License
I followed the documentation, but only thing I got as a return value from putting a job is a Promise.
I'm really missing some documentation and/or examples of how to use this client.
In particular, I have no idea how to implement a complete and resilient job lifecycle as described in the beanstalkd protocol. How do I catch and handle DEADLINE_SOON messages from the server? How will I know if the server timed out a reserved job?
Any examples would be much appreciated :)
The js-yaml dependency should be upgraded to at least 3.13.1 due to a code injection vulnerability: https://www.npmjs.com/advisories/813.
Currently it's set to 3.4.2.
/src/worker/node_modules/burstable/node_modules/beanstalkd/lib/read-queue.js:40
throw new Error('No read queue item for item, length: ' + data.length);
^
Error: No read queue item for item, length: 65511
at ReadQueue.read (/src/worker/node_modules/burstable/node_modules/beanstalkd/lib/read-queue.js:40:17)
at ReadQueue.read (/src/worker/node_modules/burstable/node_modules/beanstalkd/lib/read-queue.js:49:16)
at ReadQueue.read (/src/worker/node_modules/burstable/node_modules/beanstalkd/lib/read-queue.js:49:16)
at Socket. (/src/worker/node_modules/burstable/node_modules/beanstalkd/lib/read-queue.js:22:13)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
this.closed === true
)connect()
againput()
Error('Connection is closed')
is thrown from client.jsThis client currently does not handle disconnects, be it just a network error or the complete node fails.
In the below code, first reserve command is run and then watch command after 2 secs, but watch command callback is never run.
Is watch not allowed after reserve, so is the reserve is hanging blocking the connection and no further command is run? Is this the way beanstalkd works or is this this client library ...
const Beanstalkd = require('beanstalkd').default;
let client = new Beanstalkd('127.0.0.1', 11300);
client.connect().then(function (client) {
console.log('going to reserve');
client.reserve()
.then(function (err, jobid, payload) {
if (err) { console.log(err) }
console.log(`Job Id ${jobid}`);
console.log(`Job data ${payload.toString()}`);
client.destroy(jobid, function (err) {
if (err) { console.log(err) }
console.log(`Job deleted ${jobid}`);
});
});
})
setTimeout(() => {
console.log('going to watch')
client.watch('low-volume')
.then((tubecount) => {
console.log(tubecount);
})
.catch(err => {
console.log(err);
})
}, 2000)
setTimeout(function () {
console.log("Hello");
}, 3000);
Output
going to reserve
going to watch
Hello
Hello, beanstalkd lib is having trouble handling extended chars. See pull requests. Thanks for your awesome lib.
Please add more documentation/examples to Readme file that will show all functions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.