lib/mongodbQueue.js
function MongodbQueue(name, metrics, lock, opts) {
  if (!name) {
    throw new Error('name is required to create a mongodb queue');
  }
  if (!opts || !opts.mongodb) {
    throw new Error('mongodb is not specified to create mongodb queue');
  }
  this.queueName = name;
  this.metrics = metrics;
  this.lock = lock;
  this.lockName = opts.lockName || ('lock:sync:' + this.queueName);
  this.lockTimeout = opts.lockTimeout || 10000;
  this.mongodb = opts.mongodb;
  this.queueOptions = {
    visibility: opts.visibility || 30,
    ttl: opts.queueMessagesTTL || 24*60*60
  };
  this.queue;
}
function MongodbQueue(name, metrics, lock, opts) {
  if (!name) {
    throw new Error('name is required to create a mongodb queue');
  }
  if (!opts || !opts.mongodb) {
    throw new Error('mongodb is not specified to create mongodb queue');
  }
  this.queueName = name;
  this.metrics = metrics;
  this.lock = lock;
  this.lockName = opts.lockName || ('lock:sync:' + this.queueName);
  this.lockTimeout = opts.lockTimeout || 10000;
  this.mongodb = opts.mongodb;
  this.queueOptions = {
    visibility: opts.visibility || 30,
    ttl: opts.queueMessagesTTL || 24*60*60
  };
  this.queue;
}
construct a new queue that is backed by mongodb.
@param {String} name the name of the queue.
@param {Object} metrics an instance of fh-component-metrics client
@param {Object} lock an instance of the lock service
@param {Object} opts configuration options for the queue
@param {Object} opts.mongodb an instance of the mongodb connection. This is required.
@param {Number} opts.visibility see https://github.com/chilts/mongodb-queue#visibility---message-visibility-window
@param {Object} opts.queueMessagesTTL The TTL (time to live) value for the messages on the queue. Default to 24 hours.