Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There was a presentation from AOL/About.me on "<a href="http://www.slideshare.net/mongodb/mongodb-as-message-queue" rel="nofollow noreferrer">MongoDB as message queue</a>" at the Silicon Valley MUG in April, 2012 that you may find helpful in planning your approach.</p> <blockquote> <ol> <li>can I use any sort order for the cursor?</li> <li>does a tailing cursor work with a filter query (to skip some documents I don't want to process)? If so, how does it handle insertion of new documents - will I be notified only if the new document matches the query criteria?</li> </ol> </blockquote> <p>A tailable cursor tails the <em>end</em> of a capped collection and only in natural order. If you want a sort order you need to use an indexed query instead.</p> <p>Please have a read of the <a href="http://docs.mongodb.org/manual/tutorial/create-tailable-cursor/" rel="nofollow noreferrer">Create Tailable Cursor</a> documentation page for more information.</p> <blockquote> <p>Are tailing cursors fully supported by C# driver?</p> </blockquote> <p>Yes, tailable cursor support was implemented in the 1.1 C# driver (see: <a href="http://www.pastie.org/1977343" rel="nofollow noreferrer">code example</a>).</p> <blockquote> <p>I'd like my queue to guarantee single delivery - I mean if two clients try to read messages from the same collection they shouldn't be able to 'consume' the same message. I think this could be achieved with findAndModify, but how to do that with tailing cursor?</p> </blockquote> <p>There are a few approaches:</p> <ul> <li>Have a single reader with the tailable cursor distribute tasks to worker threads (i.e. based on worker queue depth or round-robin). This will be more efficient than having multiple readers, but is potentially a single point of failure.</li> <li>(suggested by @Contango in comment below) Have multiple readers, but use optimistic concurrency to ensure that only one worker "owns" each task. This will result in more I/O, but may simplify your design if the workers are also tailing directly.</li> </ul> <p>For more information on atomic operations, see <a href="http://docs.mongodb.org/manual/tutorial/isolate-sequence-of-operations/" rel="nofollow noreferrer">Isolate Sequence of Operations</a> in the MongoDB manual.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload