public UrlTaskRunnerController() { if (_urlRequestService == null) { _urlRequestService = new UrlRequestService(); } _urlRunningService = new UrlRunningService(_urlRequestService); }
public UrlTaskRunnerController() { if (_urlRequestService == null) { _urlRequestService = new UrlRequestService(); } _urlRunningService = new UrlRunningService(_urlRequestService); }
public void Execute(IJobExecutionContext context) { //var mapper = context.JobDetail.JobDataMap; //var url = mapper.GetString("pingUrl"); //var request = (HttpWebRequest)WebRequest.Create(url); //request.ContentLength = 0; //request.Headers.Add("Accept-Language", "en;q=0.8"); //request.ContentType = "text/html"; //request.Method = "GET"; //try //{ // var response = (HttpWebResponse)request.GetResponse(); // _log.Info("Ran Quartz UrlJob : " + url); //} //catch (WebException e) //{ // var response = (HttpWebResponse)e.Response; // _log.Error("Failed Quartz UrlJob : " + url + " Status :" + response.StatusCode, e); //} var requestService = new UrlRequestService(); var runningService = new UrlRunningService(requestService); var query = new Sql() .Select("*") .From("TD_ScheduleUrl") //.Where("LastRun < @0", DateTime.UtcNow.AddSeconds(-6.5)) //.Where("NextRun > @0", DateTime.UtcNow) //.Where("NextRun < @0", DateTime.UtcNow.AddMinutes(1)) .Where("Disabled = @0", false); var urls = ApplicationContext.Current.DatabaseContext.Database.Fetch <ScheduleUrl>(query); try { var response = runningService.GetAndRunUrls(urls); _log.Info("Ran TechDevils Job : " + response); } catch (Exception e) { _log.Error("Failed TechDevils Job", e); } }
public void Execute(IJobExecutionContext context) { //var mapper = context.JobDetail.JobDataMap; //var url = mapper.GetString("pingUrl"); //var request = (HttpWebRequest)WebRequest.Create(url); //request.ContentLength = 0; //request.Headers.Add("Accept-Language", "en;q=0.8"); //request.ContentType = "text/html"; //request.Method = "GET"; //try //{ // var response = (HttpWebResponse)request.GetResponse(); // _log.Info("Ran Quartz UrlJob : " + url); //} //catch (WebException e) //{ // var response = (HttpWebResponse)e.Response; // _log.Error("Failed Quartz UrlJob : " + url + " Status :" + response.StatusCode, e); //} var requestService = new UrlRequestService(); var runningService = new UrlRunningService(requestService); var query = new Sql() .Select("*") .From("TD_ScheduleUrl") //.Where("LastRun < @0", DateTime.UtcNow.AddSeconds(-6.5)) //.Where("NextRun > @0", DateTime.UtcNow) //.Where("NextRun < @0", DateTime.UtcNow.AddMinutes(1)) .Where("Disabled = @0", false); var urls = ApplicationContext.Current.DatabaseContext.Database.Fetch<ScheduleUrl>(query); try { var response = runningService.GetAndRunUrls(urls); _log.Info("Ran TechDevils Job : " + response); } catch (Exception e) { _log.Error("Failed TechDevils Job", e); } }
public string RunTaskNow(int id) { //ToDo: Get run now task to update the last manual run and not to update the nex run time var sql = new Sql().Select("*").From <ScheduleUrl>().Where("id = " + id); var records = DatabaseContext.Database.Fetch <ScheduleUrl>(sql); var rs = new UrlRequestService(); var urlRunningService = new UrlRunningService(rs); try { urlRunningService.CallUrls(records); } catch (Exception e) { _log.Error("Error running 'Run Now' task", e); return("Failed to run please see log for more information"); } return(DateTime.UtcNow.ToString("dd/MM/yyyy hh:mm:ss.fff")); }
public string RunTaskNow(int id) { //ToDo: Get run now task to update the last manual run and not to update the nex run time var sql = new Sql().Select("*").From<ScheduleUrl>().Where("id = " + id); var records = DatabaseContext.Database.Fetch<ScheduleUrl>(sql); var rs = new UrlRequestService(); var urlRunningService = new UrlRunningService(rs); try { urlRunningService.CallUrls(records); } catch (Exception e) { _log.Error("Error running 'Run Now' task",e); return "Failed to run please see log for more information"; } return DateTime.UtcNow.ToString("dd/MM/yyyy hh:mm:ss.fff"); }