Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 1.05 KB

README.md

File metadata and controls

30 lines (22 loc) · 1.05 KB

amqp-delay.node

NPM version

Publish messages to RabbitMQ immediately, but queue consumers will only receive these messages after a certain delay. The AMQP protocol does not support this directly, but RabbitMQ's AMQP Dead-Letter Exchanges extension we can easily achieve this functionality.

Inspired by node-amqp-schedule, but built for amqplib.

Install

$ npm install amqp-delay.node --save

Usage

var amqp = require('amqplib');

amqp.connect().then(function(conn) {
  return conn.createChannel().then(function (channel) {
    require('amqp-delay.node')(channel);
    return channel.delay(3000).publish('foo', 'bar', new Buffer('hello world'));
  });
}).then(null, console.warn);

License

MIT © Ismael Rivera