DataService KeepAlive

DataService KeepAlive aka "Tickler" is a snippet of code that runs inside a Azure Function.

It simply hits a bunch of different endpoints for the wsdl page, keeping the service from going to sleep.

The function executes on a timer, and its hitting the endpoint every minute right now.

This function is hosted under joey.castillo@cbsnorthstar.com account



Here is the code:

using System;
using System.Net;


public static void Run(TimerInfo myTimer, TraceWriter log)
{
    log.Info($"Running function at: {DateTime.Now}");

    var services = new string[]{
        "http://nsoewebservices.cbsnorthstar.com/DataHandlerService/Session/SessionService.svc?wsdl",
        "http://nsoewebservices.cbsnorthstar.com/DataHandlerService/Session/SessionServiceWebBridge.svc?wsdl",
        "http://nsoewebservices.cbsnorthstar.com/DataHandlerService/Payment/PaymentService.svc",
        "http://nsoewebservices.cbsnorthstar.com/DataHandlerService/Labor/LaborService.svc?wsdl",
        "http://nsoewebservices.cbsnorthstar.com/DataHandlerService/CommandWebBridgeService.svc?wsdl",
        "http://nsoewebservices.cbsnorthstar.com/DataHandlerService/HealthService.svc?wsdl",
        "http://nsoewebservices.cbsnorthstar.com/DataLoaderService/SessionDataWriterService.svc?wsdl",
        "http://nsoewebservices.cbsnorthstar.com/DataLoaderService/PaymentDataWriterService.svc?wsdl",
        "http://nsoewebservices.cbsnorthstar.com/DataLoaderService/LaborDataWriterService.svc?wsdl",
        "http://nsoewebservices.cbsnorthstar.com/DataLoaderService/IntegrationService.svc?wsdl",
        "http://nsoewebservices2.cbsnorthstar.com/DataHandlerService/Session/SessionServiceWebBridge.svc?wsdl",
        "http://ecm-nsoewebservices-augusta.cbsnorthstar.com/DataHandlerService/Session/SessionServiceWebBridge.svc?wsdl",
};

foreach (var serviceAddress in services)
    {
        try
            {
                log.Info($"Running {serviceAddress} at: {DateTime.Now}");

                HttpWebRequest service = (HttpWebRequest)WebRequest.Create(serviceAddress); 
               WebResponse response = service.GetResponse();
             }
       catch (Exception ex)
            {
               log.Info($"Error {serviceAddress} at: {DateTime.Now}");
            }
      }

}