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.
$ npm install amqp-delay.node --save
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);
MIT © Ismael Rivera