protected override void OnStart(string[] args) { log.Information("Car Service Started"); var imageFileFolder = ConfigurationManager.AppSettings["adapter:ImageFileFolder"]; var imageFilenameTemplate = ConfigurationManager.AppSettings["adapter:ImageFilenameTemplate"]; ocrService = new A2iACombinedTableService(ocrConfiguration); ProcessingService.OcrService = ocrService; ProcessingService.ImageFilePath = imageFileFolder; ProcessingService.ImageFileNameTemplate = imageFilenameTemplate; ProcessingService.Run(); }
void Connection_ConnectionShutdown(object source, ShutdownEventArgs reason) { consumer.ConnectionLost -= Connection_ConnectionShutdown; log.Debug("CarService: Connection lost to RabbitMQ Server due to {0}", reason.Cause); try { consumer.StopConsuming(); } catch (Exception ex) { log.Warning(ex, "CarService: Shutting down old connection to allow new connection to replace it"); } InitializeQueueConnection(); ProcessingService.StartConsumer(); }
protected override void OnStop() { ProcessingService.Stop(); ocrService.Dispose(); Log.Information("Car Service Stopped"); }