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; } }
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"); } }