public override void Run() { // This is a sample worker implementation. Replace with your logic. Trace.WriteLine("BackgroundService entry point called", "Information"); // Connect to SignalR var connection = new HubConnection(CloudConfigurationManager.GetSetting("ApiBaseUrl")); var proxy = connection.CreateHubProxy("Notifier"); connection.Start().Wait(); while (true) { Thread.Sleep(5000); var service = new VideoService(); Trace.WriteLine("Getting Media Services active jobs", "Information"); var activeJobs = service.GetActiveJobs(); foreach (var video in activeJobs.ToList()) { proxy.Invoke( "VideoUpdated", (video.JobStatus == JobStatus.Completed) ? service.Publish(video.Id) : video); } } }
public VideosController() { this.service = new VideoService(); }