// Please set the following connection strings in app.config for this WebJob to run: // AzureWebJobsDashboard and AzureWebJobsStorage static void Main() { var host = new JobHost(); // The following code ensures that the WebJob will be running continuously Console.WriteLine("Web job Start"); while (true) { try { IManageLog manageLog = new ManageLog(); var restClient = new RestClient(); var logdata = restClient.GetLogData(); Console.WriteLine(restClient.IsSuccess); if (restClient.IsSuccess) { var getStormDatas = restClient.GetStormData(); //if (getStormDatas != 0) if (getStormDatas != null) { foreach (var getStormData in getStormDatas) { IDataLakePublisher obj = new DataLakePublisher(); obj.AddMessageToTopic(getStormData, "Storm", "StormSubcription"); } manageLog.AddLog(logdata, true, "Ok"); } else { manageLog.AddLog(logdata, false, "No data found for this set of parameter"); } } else { Console.WriteLine("Storm API Service not working"); } } catch (Exception ex) { Console.WriteLine("Exception..." + ex.InnerException + "......." + ex.Message); } Thread.Sleep(5 * 60 * 1000); } // The following code ensures that the WebJob will be running continuously //host.RunAndBlock(); }
// Please set the following connection strings in app.config for this WebJob to run: // AzureWebJobsDashboard and AzureWebJobsStorage static void Main() { var host = new JobHost(); Console.WriteLine("Web job Start"); while (true) { try { // int interval = Convert.ToInt32(ConfigurationManager.AppSettings["pollinginterval"]); IManageLog manageLog = new ManageLog(); var restClient = new RestClient(); var logdata = restClient.GetLogData(); Console.WriteLine(restClient.IsSuccess); if (restClient.IsSuccess) { dynamic getWeatherDatas = restClient.GetWeatherData(); if (getWeatherDatas != null) { foreach (var getWeatherData in getWeatherDatas) { IDataLakePublisher obj = new DataLakePublisher(); obj.AddMessageToTopic(getWeatherData, "Weather", "WeatherSubcription"); } manageLog.AddLog(logdata, true, "Ok"); } else { manageLog.AddLog(logdata, false, "No data found for this set of parameter"); } } else { manageLog.AddLog(logdata, false, "Fails"); Console.WriteLine("Weather API Service not working"); } } catch (Exception ex) { Console.WriteLine("Exception..." + ex.InnerException + "......." + ex.Message); } Thread.Sleep(5 * 60 * 1000); } // The following code ensures that the WebJob will be running continuously // host.RunAndBlock(); }
static void Main(string[] args) { Console.WriteLine("Publish Started"); var restClient = new RestClient(); if (restClient.IsSuccess) { dynamic getWeatherDatas = restClient.GetWeatherData(); foreach (var getWeatherData in getWeatherDatas) { IDataLakePublisher obj = new DataLakePublisher(); obj.AddMessageToTopic(getWeatherData, "Weather", "WeatherSubcription"); } } else { Console.WriteLine("Storm API Service not working"); } Console.WriteLine("Publish Finished"); Console.ReadLine(); }