node-amqp-schedule
Install
npm install amqp-schedule
Use with postwait/node-amqp.
Usage
var scheduler = require('ampq-schedule');
var delayedPublish = scheduler(conn);
delayedPublish(exchangeName, routingKey, message, delayMs, messageOptions, callback);
delayedPublish(exchangeName, routingKey, message, date, messageOptions, callback);
Details
delayedPublish
creates a temporary queue with ttl
and dead letter exchange. The queue expires if it's empty.
You can provide a second paramereter (options
) to scheduler
. options.prefix
is the temp queue name prefix, defaults to schedule.
.
The temp queue expires after delay + options.threshold
, threshold
defaults to 10 seconds.
So if you want to publish a message 1 min later in the exchange foo
with the routing key bar
, the message will be hold in a queue named schedule.foo.bar.60000
.