コード例 #1
0
ファイル: Program.cs プロジェクト: buildmaster/resque-sharp
        static void Main(string[] args)
        {
            Console.WriteLine(resque.DummyJob.assemblyQualifiedName());

            Type t = typeof (DummyJob);
            Assembly.GetExecutingAssembly();

            Console.WriteLine(t.AssemblyQualifiedName);
            string assemblyQualification = ", ExampleRunner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
            Resque.setAssemblyQualifier(assemblyQualification);
            String server = "172.19.104.133";
            Resque.setRedis(new RedisConnection(server, 6379));

            var w = new Worker("jobs");
            var thread = new Thread(() =>
                                   {

                                       w.work(1);
                                   });
            thread.Start();
            Job.create("jobs", "LongJob");
            Job.create("jobs", "DummyJob", "foo", 20, "bar");

            Job.create("jobs", "ErrorJob");

            System.Console.ReadLine();
            w.Dispose();
            thread.Abort();
        }
コード例 #2
0
ファイル: Redis.cs プロジェクト: atorres757/resque-sharp
 public Redis(Exception exception, Worker worker, String queue, Object payload)
 {
     this.exception = exception;
     this.worker = worker;
     this.queue = queue;
     this.payload = payload;
 }
コード例 #3
0
ファイル: Worker.cs プロジェクト: buildmaster/resque-sharp
 public static Worker find(string id)
 {
     if (isExisting(id))
     {
         string[] components = id.Split(":".ToCharArray());
         string queuesPacked = components[components.Length - 1];
         string[] queues = queuesPacked.Split(",".ToCharArray());
         Worker worker = new Worker(queues);
         worker.id = id;
         return worker;
     }
     else
     {
         return null;
     }
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: atorres757/resque-sharp
        static void Main(string[] args)
        {
            Console.WriteLine(resque.DummyJob.assemblyQualifiedName());

            Type t = typeof(DummyJob);
            Assembly.GetExecutingAssembly();

            Console.WriteLine(t.AssemblyQualifiedName);
            string assemblyQualification = ", ExampleRunner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
            Resque.setAssemblyQualifier(assemblyQualification);
            String server = "192.168.1.7";
            Resque.setRedis(new Redis(server, 6379));
            Job.create("jobs", "DummyJob", "foo", 20, "bar");
            Worker w = new Worker("*");
            w.work(1);
        }
コード例 #5
0
        public void CanWorkOnAllQueues()
        {
            Job.create("high", "resque.GoodJob");
            Job.create("critical", "resque.GoodJob");
            Job.create("blahblah", "resque.GoodJob");

            worker = new Worker("*");

            worker.work(0);

            Console.WriteLine(Resque.size("high"));
            Console.WriteLine(Resque.size("critical"));
            Console.WriteLine(Resque.size("blahblah"));

            Assert.AreEqual(Resque.size("high"), 0);
            Assert.AreEqual(Resque.size("critical"), 0);
            Assert.AreEqual(Resque.size("blahblah"), 0);
        }
コード例 #6
0
        public void CanWorkOnMultipleQueues()
        {
            Job.create("high", "resque.GoodJob");
            Job.create("critical", "resque.GoodJob");

            worker = new Worker(new string[] {"critical", "high" });

            worker.process();
            Assert.AreEqual(Resque.size("high"), 1);
            Assert.AreEqual(Resque.size("critical"), 0);

            worker.process();
            Assert.AreEqual(Resque.size("high"), 0);
        }
コード例 #7
0
        public void ProcesesAllQueuesInAlphabeticalOrder()
        {
            Job.create("high", "resque.GoodJob");
            Job.create("critical", "resque.GoodJob");
            Job.create("blahblah", "resque.GoodJob");

            worker = new Worker("*");

            //worker.work(0, (List<String> queueList) => { int a; });
        }
コード例 #8
0
        public void Init()
        {
            //server = "ec2-184-73-7-218.compute-1.amazonaws.com";
            server = "172.19.104.133";

            Resque.setRedis(new RedisConnection(server, 6379,allowAdmin:true));
            Resque.redis().Server.FlushAll();
            worker = new Worker("jobs");
            //Job.create("jobs", "resque.DummyJob", 20, "/tmp");
        }
コード例 #9
0
        public void Init()
        {
            // This is the IP address of my computer running Redis.
            //server = "ec2-184-73-7-218.compute-1.amazonaws.com";
            server = "172.19.104.133";

            Resque.setRedis(new RedisConnection(server, 6379,allowAdmin:true));
            Resque.redis().Server.FlushAll();

            Exception ex = new Exception(testString);
            Worker worker = new Worker();
            String queue = testString;
            payload = Encoding.UTF8.GetBytes(testString);

            myRedis = new Failure.Redis(ex, worker, queue, payload);
        }
コード例 #10
0
ファイル: WorkerTest.cs プロジェクト: atorres757/resque-sharp
        public void Init()
        {
            server = "ec2-184-73-7-218.compute-1.amazonaws.com";
            //string server = "192.168.56.102";

            Resque.setRedis(new Redis(server, 6379));
            Resque.redis().FlushAll();
            worker = new Worker("jobs");
            //Job.create("jobs", "resque.DummyJob", 20, "/tmp");
        }
コード例 #11
0
        public void Init()
        {
            // This is the IP address of my computer running Redis.
            server = "ec2-184-73-7-218.compute-1.amazonaws.com";
            //server = "192.168.56.102";

            Resque.setRedis(new Redis(server, 6379));
            Resque.redis().FlushAll();

            Exception ex = new Exception(testString);
            Worker worker = new Worker();
            String queue = testString;
            payload = Encoding.UTF8.GetBytes(testString);

            myRedis = new Failure.Redis(ex, worker, queue, payload);
        }