static void Run()
        {
            IConsumerRegistrationContract cc = Turbine.Consumer.AppUtility.GetConsumerRegistrationContract();
            IConsumerRun         run         = Turbine.Consumer.AppUtility.GetConsumerRunContract();
            IJobQueue            queue       = cc.Register(run);
            IJobConsumerContract contract    = queue.GetNext(run);

            jobs_available = (contract != null);

            if (jobs_available == false)
            {
                return;
            }

            try
            {
                contract.Setup();
            }
            catch (System.Data.Entity.Core.OptimisticConcurrencyException ex)
            {
                var msg = String.Format(
                    "Setup Failed({0}): OptimisticConcurrencyException, {1}",
                    contract.Id, ex.Message);
                Debug.WriteLine(msg, label);
                throw;
            }
            catch (Turbine.Lite.Web.Resources.Contracts.InvalidStateChangeException ex)
            {
                var msg = String.Format(
                    "Setup Failed({0}): InvalidStateChangeException, {1}",
                    contract.Id, ex.Message);
                Debug.WriteLine(msg, label);
                throw;
            }

            Debug.WriteLine(String.Format("{0} Working Directory: {1}",
                                          DateTime.Now.ToString(),
                                          contract.Process.WorkingDirectory),
                            label);

            // Execute Job
            try
            {
                contract.Running();
            }
            catch (Exception ex)
            {
                contract.Error(String.Format(
                                   "threadid:{0}, machine:{1}, exception:{2}",
                                   Thread.CurrentThread.ManagedThreadId, System.Environment.MachineName, ex.Message)
                               );
                throw;
            }

            IProcess process    = contract.Process;
            var      inputDict  = process.Input;
            var      outputDict = new Dictionary <string, Object>();

            foreach (var key in inputDict.Keys.ToArray <string>())
            {
                if (inputDict[key] == null)
                {
                    continue;
                }
                outputDict[key] = String.Format("{0} OUTPUT", inputDict[key]);
                process.AddStdout(String.Format("Add Output {0}\n", key));
            }

            process.AddStdout("Fake Job Completed");
            process.Output = outputDict;
            contract.Success();
        }