예제 #1
0
        public static void ListenToQueue([QueueTrigger("task")] string message)
        {
            ITaskDelegate taskDelegate = Container.Get <ITaskDelegate>();

            try
            {
                taskDelegate.PerformNextTask(message);
            }
            catch (Exception taskError)
            {
                Console.WriteLine("Unable to perform task error: " + taskError.Message);
                throw;
            }
        }
예제 #2
0
        public override void Run()
        {
            Trace.Listeners.Add(new Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener());

            Trace.TraceInformation("BackgroundWorker entry point called", "Information");

            while (true)
            {
                ITaskDelegate taskDelegate = Container.Get <ITaskDelegate>();

                try
                {
                    taskDelegate.PerformNextTask();
                }
                catch (Exception taskError)
                {
                    Trace.TraceError("Unable to perform task", taskError);
                }


                Thread.Sleep(5 * 1000);
                Trace.TraceInformation("Working", "Information");
            }
        }