public TestPackage(string[] queues) { UnderTest = new Worker(JobCreatorMock.Object, FailureServiceMock.Object, RedisMock.Object, queues); JobCreatorMock .Setup(x => x.CreateJob(It.IsAny<IFailureService>(), It.IsAny<Worker>(), It.IsAny<QueuedItem>(), It.IsAny<string>())) .Returns(new TestPackage.TestJob()); RedisMock.Setup(x => x.BLPop(It.IsAny<string[]>(), It.IsAny<int>())).Returns(new Tuple<string, string>("queue", QueuedItem.ToJson())); }
public System.Threading.Tasks.Task WorkAsync(params string[] queues) { var worker = new Worker(JobCreator, FailureService, Client, queues); Workers.Add(worker); return System.Threading.Tasks.Task.Factory.StartNew(() => worker.Work()); }
public void Work(params string[] queues) { var worker = new Worker(JobCreator, FailureService, Client, queues); Workers.Add(worker); worker.Work(); }
public IJob CreateJob(IFailureService failureService, Worker worker, QueuedItem deserializedObject, string queue) { throw new NotImplementedException(); }
public static Type Create(object payload, Exception exception, Worker worker, String queue) { Activator.CreateInstance(_backend, payload, exception, worker, queue); return _backend; }
/// <summary> /// Use this factory to create a new worker /// Pass in a string[] of queue names /// Order is important, the worker will service all items in a specific /// queue until there are no /// </summary> /// <param name="queues"></param> /// <returns></returns> public static Worker GetWorker(string[] queues) { Worker newWorker = new Worker(queues); return newWorker; }