Exemple #1
0
        private static Int32 SingleJobStart(String dsBaseAddress, String queueName, String handle)
        {
            //Avoid all sub process to start at the same moment.
            Thread.Sleep(new Random().Next(1000, 3000));
            SetupColors();
            LoadConfiguration();
            var uri          = new Uri(dsBaseAddress);
            var bootstrapper = new DocumentStoreSingleQueueClientBootstrapper(uri, queueName, handle);
            var jobStarted   = bootstrapper.Start(_jobsHostConfiguration);

            if (jobStarted)
            {
                Console.Title = String.Format("Pid {0} - Queue {1} Job Poller Started",
                                              Process.GetCurrentProcess().Id, queueName);

                MongoLog.SetProgramName(String.Format("ds-job[Queue:{0}]", queueName));
                Console.WriteLine("JOB STARTED: Press any key to stop the client");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("JOB CANNOT START!!!! CLOSING!!!!");
                Thread.Sleep(3000);
                Environment.Exit(-1); //code to signal that queue is not supported.
            }
            return(0);
        }