public TestPackage(RedisConnection conn) { Redis = new RedisBooksleeveConnector(conn); var redisFS = new Resque.FailureService(new RedisBackendFactory(Redis)); UnderTest = new Resque.Resque(new JobCreator(), redisFS, Redis); conn.Wait(conn.Keys.Remove(0, Redis.KeyInNamespace("queue:testQueue"))); }
public string[] Queues(bool fetch = false) { if (_queues.Contains("*") || !fetch) { return(_queues); } var queues = Resque.Queues().ToArray(); Array.Sort(queues); return(queues); }
public static bool Create(string queue, string className, JArray args, bool monitor = false) { if (String.IsNullOrEmpty(className)) { throw new NoClassError(); } var id = BitConverter.ToString(MD5.Create().ComputeHash(new Guid().ToByteArray())).Replace("-", "").ToLower(); if (monitor) { Jobs.Status.Create(id); } var data = new JObject { new JProperty("class", className), new JProperty("args", args) }; Resque.Push(queue, data); return(true); }
public string[] FetchQueues() { return(Resque.Queues().ToArray()); }
public string[] FetchQueues() { return(Resque.Queues().Select(key => key.ToString()).ToArray()); }
public static Job Reserve(string queue) { var payload = Resque.Pop(queue); return(payload == null ? null : new Job(queue, payload)); }
public Worker(string queue) { _queues = queue == "*" ? Resque.Queues().ToArray() : new[] { queue }; Id = string.Format("{0}:{1}:{2}", Dns.GetHostName(), System.Diagnostics.Process.GetCurrentProcess().Id, String.Join(",", _queues)); }