public virtual void Reschedule(DateTime nextRun)
        {
            Schedule schedule = new Schedule
            {
                NextRun = nextRun,
                Repeat = Repeat.Custom
            };

            this["MongoQueue"].ToBsonDocument().Set("Schedule", schedule.ToBsonDocument());
            this.Collection.Save(this);
        }
Exemplo n.º 2
0
        public void Push(BsonDocument data, Schedule schedule = null)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            schedule = schedule ?? new Schedule { Repeat = Repeat.None, NextRun = DateTime.UtcNow };

            var meta = new BsonDocument();
            meta["QueueName"] = this.QueueName;
            meta["Schedule"] = schedule.ToBsonDocument();
            data["MongoQueue"] = meta;
            this.db.GetCollection(this.CollectionName).Save(data);
        }