Comments (6)
Each message after being published gets a UUID. A message with an ID can not be published twice.
Additionally, let say you were in the process of publishing a message and your application crashed. Your message could be published or lost.
At the moment of the failure, if your message has been sent through the wires to Redis and has been received successfully then it will be published.
It is up to your application to manage properly such failures.
from redis-smq.
I'm not really talking about recovery from failures. I think having a unique job id is a legit use-case when you want to avoid duplicated tasks. E.g.
I have a prioritized queue.
I want to enqueue all tasks in an interval but sometimes I want to enqueue just some tasks. If a latter task is already in the waiting list, I expect the queue to just skip enqueuing it twice if they have the same priority.
And there's also a particular moment when I want to push a task with higher priority. I expect the queue to accept the new task, move it to the top and remove the lower-priority-and-duplicated task.
from redis-smq.
Well, as I said before, the MQ uses a unique ID for each message.
As the message ID is set by the MQ you can not publish two messages with the same ID. But you can publish two messages with the same payload (body). The MQ does not care about the message payload. It is not its business.
from redis-smq.
I want to enqueue all tasks in an interval but sometimes I want to enqueue just some tasks. If a latter task is already in the waiting list, I expect the queue to just skip enqueuing it twice if they have the same priority.
And there's also a particular moment when I want to push a task with higher priority. I expect the queue to accept the new task, move it to the top and remove the lower-priority-and-duplicated task.
The MQ does not work this way. Here is an example.
Considering that queue1
is a priority queue and has been already created.
import { Producer, Message } from 'redis-smq';
const msg1 = new Message().setQueue('queue1').setBody('123').setPriority(Message.MessagePriority.HIGH);
const msg2 = new Message().setQueue('queue1').setBody('123').setPriority(Message.MessagePriority.HIGH);
const msg3 = new Message().setQueue('queue1').setBody('123').setPriority(Message.MessagePriority.LOW);
const producer = new Producer();
producer.produce(msg1, (err) => {
// ...
})
producer.produce(msg2, (err) => {
// ...
})
producer.produce(msg3, (err) => {
// ...
})
msg1
,msg2
, andmsg3
have the same payload.msg1
,msg2
have the same prioritymsg3
has a different priority thanmsg1
andmsg2
The MQ see all messages as different messages, no matter if they have the same properties or not.
All messages will be produced with different IDs and delivered with respect to their priorities. No messages will be replaced or removed.
This is the way this MQ works.
from redis-smq.
Thanks for the explanation but I do understand how redis-smq works. It offers at-most-once and at-last-once delivery. It's more like a suggestion than a question. Anyway, thanks for your patience!
from redis-smq.
Related Issues (20)
- LockManagerAcquireError: could not acquire a lock. HOT 3
- consumer for all queues HOT 2
- Any chance of updating Redis to v4 HOT 10
- [分享]可以让Redis消息队列更好的一篇文章 [Share] An article that can make Redis message queues better
- Feature request: Topic based routing HOT 3
- Cannot serialize `bigint` HOT 1
- Redis smq randomly throws an error that make app crashes HOT 2
- Support ioredis cluster configuration
- Upgrade to Redis 4 HOT 5
- Use instance based instead of a system wide configuration HOT 2
- Producer & Consumer seem to be ignoring config HOT 6
- How are messages stored in brokers in redis-smq? HOT 1
- Not working with docker compose HOT 5
- MaxListenersExceededWarning: Possible EventEmitter memory leak detected HOT 15
- LockManagerExtendError: Acquired lock could not be extended HOT 3
- random retryDelay HOT 4
- [Feature] Support option for a missing interval in the scheduler. HOT 4
- How to delete message in consumer HOT 4
- Error: ENOENT: no such file or directory, open '../lua/zpophgetrpush.lua HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis-smq.