Exemple #1
0
 public void SetSelector(TQItemSelector selector)
 {
     this.selector     = selector;
     this.QueryFeature = MongoSelector.GetQuery(this.selector);
     this.SortFeature  = MongoSelector.GetSort(this.selector);
     OptimiseForSelector();
 }
Exemple #2
0
        public void OptimiseForSelector()
        {
            CheckConnection();

            try
            {
                Collection.EnsureIndex(MongoSelector.GetIndex(selector));
            }
            catch (MongoConnectionException e)
            {
                throw new QueueConnectionException("can't ensure index", e);
            }
        }
Exemple #3
0
        public TaskMessage GetItemFifo()
        {
            CheckConnection();

            TaskQueue.TQItemSelector selector = TaskQueue.TQItemSelector.DefaultFifoSelector;
            var cursor = Collection.Find(MongoSelector.GetQuery(selector)).SetSortOrder();

            cursor.Limit = 1;
            MongoMessage mms = cursor.FirstOrDefault();

            if (mms == null)//empty
            {
                return(null);
            }
            TaskMessage msg = new TaskMessage(mms.ExtraElements);

            msg.Holder.Add("_id", mms.id.Value);
            return(msg);
        }