rabbitmq-tt-delay-message
v0.0.1
Published
```bash $ npm install --save rabbitmq-tt-delay-message ```
Downloads
4
Readme
Cài module:
$ npm install --save rabbitmq-tt-delay-message
Publish tới queue
import {Publisher} from 'rabbitmq-tt-delay-message';
var publisher = Publisher(''amqp://username:password@host/vhost');
var nb = 0;
setInterval(function() {
publisher.publish('x-delay-message', 'delaymessage', {number: nb++, test: 3}, 10000);
}, 1);
Xử lý các message trong queue
import {DelayExchangeManage} from 'rabbitmq-tt-delay-message';
var delayExchangeManage = DelayExchangeManage('amqp://username:password@host/vhost');
const handle = (params, cb) => {
console.log(params);
cb();
};
delayExchangeManage.addWorker('x-delay-message', 'delaymessage', handle);