예제 #1
0
 /// <summary>
 /// Method called when service is started
 /// </summary>
 /// <param name="args">Command Arguments</param>
 protected override void OnStart(string[] args)
 {
     Log.Info("OnStart");
     this.amazonSQSConfig                = new AmazonSQSConfig();
     this.amazonSQSConfig.ServiceURL     = AWSConstants.FederationProcessingQueueUrl;
     this.amazonSQSConfig.RegionEndpoint = Amazon.RegionEndpoint.GetBySystemName(AWSConstants.AWSRegion);
     this.amazonSQSClient                = new AmazonSQSClient(this.amazonSQSConfig);
     this.dbDal     = new PostGISDAL(ConfigurationManager.ConnectionStrings["FRESH.PostGIS"].ConnectionString, ConfigurationManager.AppSettings["PostGISSchema"], "deprecated");//TODO: once all needed functions written, change to IDatabaseDAL and set to appropriate DB dal
     this.runThread = new Thread(new ThreadStart(this.PollSQS));
     this.runThread.IsBackground = true;
     this.runThread.Start();
     Log.Info("OnStartComplete");
 }
예제 #2
0
        protected override void OnStart(string[] args)
        {
            string currentUTCTime = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            Log.Info(currentUTCTime + " >>> OnStart");

            try
            {
                this.dbDal = new PostGISDAL(ConfigurationManager.ConnectionStrings["FRESH.PostGIS"].ConnectionString, ConfigurationManager.AppSettings["PostGISSchema"], ConfigurationManager.AppSettings["FederationEndpointURL"]);
                Log.Info(">>> Creating service task timer");
                deletionTimer = new Timer(this.TimerTick, null, Convert.ToInt64(ConfigurationManager.AppSettings["IncidentInterval"]),Timeout.Infinite); 
                Log.Info(" >>> OnStart Complete");
            }
            catch (Exception e)
            {
                Log.Error("Error in OnStart: " + e);
            }
           
        }