https://github.com/kaizhu256/aftership-beanstalk-client
https://github.com/kaizhu256/aftership-beanstalk-client
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kaizhu256/aftership-beanstalk-client
- Owner: kaizhu256
- Created: 2014-06-22T06:19:34.000Z (almost 11 years ago)
- Default Branch: unstable
- Last Pushed: 2018-10-27T07:32:28.000Z (over 6 years ago)
- Last Synced: 2025-01-17T14:52:46.463Z (3 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
aftership-beanstalk-client [](https://travis-ci.org/kaizhu256/aftership-beanstalk-client?branch=unstable)
==========================
aftership beanstalk client## quickstart
```
git clone [email protected]:kaizhu256/aftership-beanstalk-client.git
cd aftership-beanstalk-client
## npm install fivebeans and other dependencies
npm install
## start a consumer listening to a beanstalk server on localhost:11300
npm start --host=localhost --port=11300
```## library usage example
```
/* example.js */
/*jslint indent:2*/
(function () {
'use strict';
var aftership_beanstalk_client, consumer, fivebeans, host, port;
/* require aftership_beanstalk_client */
aftership_beanstalk_client = require('./aftership-beanstalk-client.js');
/* require fivebeans */
fivebeans = require('fivebeans');
/* init host var */
host = 'localhost';
/* init port var */
port = 11300;
/* create new beanstalk consumer */
consumer = new fivebeans.client(host, port);
consumer
.on('connect', function () {
/* consumer can now be used */
console.log('connected to beanstalk server ' + host + ':' + port);
return;
})
.on('error', function (error) {
/* connection failure */
console.error(error);
return;
})
.on('close', function () {
/* underlying connection has closed */
return;
})
.connect();
/* add aftership_beanstalk_client.beanstalkConsumerHandler to consumer.reserve */
consumer.reserve(function (error, jobId, payload) {
console.log('processing job ' + jobId + ' ' +
JSON.stringify(payload && payload.toString()));
aftership_beanstalk_client.beanstalkConsumerHandler(error, jobId, payload, consumer);
});
}());
```## todo
- include order increment_id in tracking info
- add retries to timeout handling## changelog
#### 2014.6.23
- add npm start
- add example.js and library usage example#### 2014.6.22
- integrate consumer into beanstalkd
- implement pagination in consumer for shipping list
- setup automated travis-ci build
- setup encryption mechanism## admin
- [edit README.md](https://github.com/kaizhu256/aftership-beanstalk-client/edit/unstable/README.md)
- counter 5