Comments (4)
Hi @hanwencheng,
Yes, the id will not change.
However, the ordering of the messages is not by id but by it's visibility (the 'visible' field). When a message is retrieved this field is updated to be now plus it's visibility window.
However, it does mean that if a message goes back on the stack, it will be visible immediately, but this doesn't mean it'll be next in the list, but it'll be somewhere near the start.
Your code should never depend on delivery of any particular message in any particular order. Even though there are some rules to this, it's better if your code stays independent of it and just takes each message as it comes. :) I'm sure you're doing this already, but am just clarifying.
Thanks for your question.
Andy
from mongodb-queue.
Oh wait, I mis-read my code! Silly me.
Yes, it is ordered by _id
. :)
from mongodb-queue.
Thanks, Andy
Thanks for the clarification, that is a important point for me because the message processing progress need to be order by their receiving time, then everything will be fine.
Hanwen
from mongodb-queue.
Yes, but you shouldn't actually rely on that. If you need to rely on the ordering then you might need to look for another solution.
For example, if you have three messages and you process multiple messages at a time, then you may well fail with message number 1, then process 2 and 3 before 1 timesout and gets put back on the queue.
Anyway, just so you know. :)
from mongodb-queue.
Related Issues (18)
- get() method doesn't follow the FIFO HOT 10
- Incorrect indexes? HOT 8
- findOneAndUpdate vs findAndModify HOT 6
- Long polling with queue.get? HOT 6
- Date type instead of string for datetime fields HOT 2
- Cant connect HOT 4
- Dead Queues Management HOT 1
- concurrency? HOT 4
- for await...of as interface for queue consumer
- How can i connect this with mongoose? HOT 2
- returnOriginal flag is deprecated in findOneAndUpdate
- Batch Processing
- Using mongdb nodejs driver 4 HOT 2
- Error acknowledging a queue: Queue.ack(): Unidentified ack HOT 3
- Support for node-mongodb-native2 HOT 3
- Support MongoDB 3.x HOT 3
- awesome package, how to work on all queued messages effectively? HOT 7
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 mongodb-queue.