RSMQ: A lightweight Redis based message queue for Node.js
smrchy.github.io
smrchy.github.io
I'll just leave this here for you: http://bravenewgeek.com/you-cannot-have-exactly-once-deliver...
Welcome to message queues. Where the network is both your best friend and enemy.
If the recipient fails to process the message for some reason it will reappear after the visibility timeout.
[1] http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-o...
The reason that is important is because it has large ramifications for other parts of the delivery promise (such as order guarantees) or the implementation of the protocol (such as how chatty MQTT is).
It is relatively trivial to implement a system with exactly once delivery if you allow for client filtering and don't have performance or delivery time constraints.
However, this quote, "If you run a Redis server and currently use Amazon SQS or a similar message queue you might as well use this fast little replacement" is greatly over simplifying things.
Amazon SQS gives you acknowledgement guarantees that are not possible with Redis. Don't get me wrong, I love Redis, but you can't reliably trust that writes happen.
This is unrelated, but what are you using for the docs? I love how it looks and scrolls with the topics and code examples right beside the methods.
Currently we're processing about 30 million messages per day on a single redis server with two worker instances.
A message queue stores messages so that nothing gets lost, when there are no subscribers listening.
A new message will be delivered to only one recipient at a time while in a pub/sub system all subscribers would receive a message and would either all work on the same message/job or would have to decide who does what.
Whoever receives a message will "work" on that message and after success will delete the message. Usually within seconds. So no one will ever receive that message again. If a receiving process crashes or some error happens the message will just pop up again and will be received again after a set invisibility time (default is 30s).
So dropping messages in this message queue keeps them there until some receiver(s) delete them. It does not matter how many message producers / consumers there are. The queue handles the problem of not delivering a message to two consumers within a set time.