Ejemplo n.º 1
0
        public void submitTask(String task, TaskObject taskCtx)
        {
            taskCtx.setTask(task);

            var name = zk.Create("/tasks/task-", task.GetBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PersistentSequential);

            taskCtx.setTaskName(name);

            watchStatus(name.Replace("/tasks/", "/status/"), taskCtx);
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            //host: 192.168.183.134:2181,192.168.183.135:2181,192.168.183.136:2181
            Client c = new Client(args[0]);

            c.startZK();

            while (!c.isConnected())
            {
                Thread.Sleep(100);
            }

            TaskObject task1 = new TaskObject();
            TaskObject task2 = new TaskObject();

            c.test();
            c.submitTask("Sample task", task1);
            //c.submitTask("Another sample task", task2);

            //task1.waitUntilDone();
            //task2.waitUntilDone();

            Console.ReadLine();
        }