Crazy simple redis-backed scheduling
QueuePasa makes it super easy to schedule messages to be delivered at a later time/date.
It's as easy as this:
qpasa; //This will deliver the message 'Hey' in 60,000ms (1 minute).
You can also schedule an exact date and time to deliver instead. Just pass a Date object instead of a delay:
Warning: Don't pass a unix timestamp as an integer (a string is fine) because it will be interpreted as a delay.
qpasa; //Bad! Your message will be delivered in a few decades!qpasa; //However, this works as expected. Just be careful.
var QueuePasa =//These are the current options and their defaults...qpasa =host: '127.0.0.1'port: 6379groupBy: 'day'interval: 5000delayMultiplier: 1prefix: 'qp';qpasa;qpasa;qpasa;
Couldn't be easier.
The options object isn't necessary. You can just use
new QueuePasa() if the defaults are to your liking.
host: Where is the Redis instance?
default = '127.0.0.1'
port: The Redis port.
default = 6379
groupBy: QueuePasa speeds things up by placing your queued items in buckets by day. If you have a high volume, you can change this to
default = 'day'
interval: How often to check for messages.
default = 5000
delayMultiplier: You can have your delay number multiplied. For example, set delayMultiplier to
60000 then your delay argument will be interpreted as minutes instead of miliseconds.
default = 1
prefix: The first part of the bucket name. Buckets look something like
default = 'qp'