Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

node.js queue on top of mongo db and mongolian

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib Update from anode repo March 01, 2012
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .npmignore
Octocat-spinner-32 README.markdown
Octocat-spinner-32 mongueue.js
Octocat-spinner-32 package.json
README.markdown

mongueue is a simple and nasty mongodb-based queue. it uses mongolian collections as the queue storage.

usage:

var
  mongodb = require('mongodb'),
  Mongueue = require('../mongueue');

var q,
    options = {
    user: "user",
    pass: "pass",
    dbname: "cron",
    queuename: "name",
    host: "localhost",
    port: 6000,
    collection: 'queueName'
};

q = new Mongueue(null, options, function (err, mongueue) {
        if (err) {
            test.ok(!err, "failed to create queue" + err.errmsg);
            test.done();
        }
        sample();
    })


function sample() {
  q.waitDequeue(
  10, // ttl (in seconds)
  2,  // backoff (in seconds)
  function(err, item, releasefn) {
    console.log("the following item was dequeued:", item);
    releasefn(err);
    q.stop();
  });

  q.enqueue("this is the item to enqueue. any javascript object is good", function(err) {
    if (err) console.error("couldn't queue the item");
    else console.log("item queued");
  });
}

Something went wrong with that request. Please try again.