https://github.com/slavahatnuke/plus.pipeline
https://github.com/slavahatnuke/plus.pipeline
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/slavahatnuke/plus.pipeline
- Owner: slavahatnuke
- Created: 2017-11-23T11:11:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-23T23:41:54.000Z (over 7 years ago)
- Last Synced: 2025-03-18T12:11:25.862Z (2 months ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# plus.pipeline
## FlatApi
```javascript
const {Queue, Worker, FlatApi} = require('./index');const redis = require('redis');
const redisClient = redis.createClient({
host: 'localhost',
port: 6379
});const queue = Queue(redisClient);
queue('add/1').add(10);
queue('add/1').add(20);queue('add/2').add(50);
queue('add/2').add(60);const api = FlatApi({
'add/1': (data) => {
// console.log(data);
return data + 1
},
'add/2': (data) => {
// console.log(data);
return data + 2;
},
});const worker = Worker(queue, api);
worker.subscribe((result) => console.log(result));
worker.start();// 11
// 52
// 21
// 62```