Esempio n. 1
0
            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()));

            }
Esempio n. 2
0
 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());
 }
Esempio n. 3
0
 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();
 }
Esempio n. 5
0
 public static Type Create(object payload, Exception exception, Worker worker, String queue)
 {
     Activator.CreateInstance(_backend, payload, exception, worker, queue);
     return _backend;
 }
Esempio n. 6
0
		/// <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;
		}