Ejemplo n.º 1
0
        private static void RegisterQuartzInSimpleInjector(Assembly[] jobAssemblies = null)
        {
            var log = HostLogger.Get(typeof(SimpleInjectorScheduleJobServiceConfiguratorExtensions));

            Container container = SimpleInjectorHostBuilderConfigurator.Container;

            ISchedulerFactory schedulerFactory = new StdSchedulerFactory();

            if (jobAssemblies == null)
            {
                container.RegisterSingleton <IJobFactory>(new SimpleInjectorJobFactory(container));
            }
            else
            {
                container.RegisterSingleton <IJobFactory>(new SimpleInjectorDecoratorJobFactory(container, jobAssemblies));
            }

            container.RegisterSingleton <ISchedulerFactory>(schedulerFactory);

            if (!Environment.GetCommandLineArgs().Any(x => x.ToLower() == "install" || x.ToLower() == "uninstall"))
            {
                container.RegisterSingleton <IScheduler>(() =>
                {
                    IScheduler scheduler = schedulerFactory.GetScheduler();
                    scheduler.JobFactory = container.GetInstance <IJobFactory>();
                    return(scheduler);
                });
            }

            Func <IScheduler> schedulerFunc = () => container.GetInstance <IScheduler>();

            ScheduleJobServiceConfiguratorExtensions.SchedulerFactory = schedulerFunc;

            log.Info("[Topshelf.SimpleInjector.Quartz] Quartz configured to construct jobs with SimpleInjector.");
        }
Ejemplo n.º 2
0
        public async void Stop()
        {
            try
            {
                // Stop the postion report pipelined computation by issuing a cancellation request.
                _environment.TokenSource.Cancel();
                await Task.WhenAll(_pipeline.Completion);
            }
            catch (OperationCanceledException)
            {
                HostLogger.Get <Service>().Debug("The Power Position Tool was cancelled.");
            }
            catch (Exception ex)
            {
                HostLogger.Get <Service>().Error("The Power Position Tool completed with an error.", ex);
            }
            finally
            {
                if (_subscription != null)
                {
                    _subscription.Dispose();
                    _subscription = null;
                }

                if (_environment != null)
                {
                    _environment.TokenSource.Dispose();
                    _environment = null;
                }
            }
        }
Ejemplo n.º 3
0
        public bool Start(HostControl hostControl)
        {
            _log = HostLogger.Get <AkkaService>();

            _log.Info("Service Starting...");

            hostControl.RequestAdditionalTime(TimeSpan.FromSeconds(10));

            Thread.Sleep(1000);

            /*
             * ThreadPool.QueueUserWorkItem(x =>
             * {
             *
             *  Thread.Sleep(3000);
             *  _log.Info("Requesting a restart!!!");
             *  hostControl.Restart();
             *  _log.Info("Dying an ungraceful death");
             *  throw new InvalidOperationException("Oh, what a world.");
             * });
             */
            _log.Info("AkkaService Started");

            _pipeline = new ProcessPipeline();

            // Lets subscribe to Data-Stream


            return(true);
        }
Ejemplo n.º 4
0
        public bool Start(HostControl hostControl)
        {
            _log = HostLogger.Get <SampleService>();

            _log.Info("SampleService Starting...");

            hostControl.RequestAdditionalTime(TimeSpan.FromSeconds(10));

            Thread.Sleep(1000);

            ThreadPool.QueueUserWorkItem(x =>
            {
                Thread.Sleep(3000);

                _log.Info("Requesting a restart!!!");

                hostControl.Restart();

//                _log.Info("Dying an ungraceful death");
//
//                throw new InvalidOperationException("Oh, what a world.");
            });
            _log.Info("SampleService Started");

            return(true);
        }
Ejemplo n.º 5
0
 void Alert(ServiceController service)
 {
     try
     {
         HostLogger.Get <ServiceStatusChecker>().Info(service.DisplayName + " is : " + service.Status.ToString());
         if (service.Status == ServiceControllerStatus.Stopped)
         {
             SendMail(service);
             Thread.Sleep(1000);
             service.Refresh();
             try
             {
                 HostLogger.Get <ServiceStatusChecker>().Info("Restarting Service : " + service.DisplayName);
                 service.ExecuteCommand((int)SimpleServiceCommands.RestartWorker);
             }
             catch (Exception e)
             {
                 HostLogger.Get <ServiceStatusChecker>().Error("Failed to restart service : ", e);
             }
         }
     }
     catch (Exception e)
     {
         HostLogger.Get <ServiceStatusChecker>().Error("Service doesn't exist ", e);
     }
 }
Ejemplo n.º 6
0
        private static Hashtable htStrToHex = new Hashtable(); //str--hex

        /// <summary>
        /// debug模式下会打印到控制台,release输出到数据库
        /// </summary>
        /// <param name="msg"></param>
        public static void writeLog(string msg)
        {
            Console.WriteLine(msg + "\r\n");

            //log.Info(msg);
            HostLogger.Get <UtilClass>().Info(msg);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Конфигурация сервиса средствами Topshelf.
        /// </summary>
        private static void ConfigureService
        (
            HostConfigurator configurator
        )
        {
            configurator.ApplyCommandLine();

            var service = configurator.Service <WebHello>();

            service.SetDescription("ASP.NET Hello service");
            service.SetDisplayName("Web Hello Service");
            service.SetServiceName("WebHelloService");

            service.StartAutomaticallyDelayed();
            service.RunAsLocalSystem();
            service.EnableShutdown();

            // Необязательная настройка восстановления после сбоев
            service.EnableServiceRecovery(recovery =>
            {
                recovery.RestartService(1);
            });

            // Реакция на исключение
            service.OnException(exception =>
            {
                var log = HostLogger.Get <WebHello>();
                log.ErrorFormat($"Exception {exception}");
            });
        }
        public MergePagesService(string inputFolderPath, IDocumentFactory documentFactory)
        {
            MergePagesQueueManager.PrepareQueues();

            logger = HostLogger.Get <MergePagesService>();

            this.documentFactory = documentFactory;
            directoryService     = new DirectoryService();
            directoryService.SetInputDirectory(inputFolderPath);

            newFileEvent  = new AutoResetEvent(false);
            stopWorkEvent = new ManualResetEvent(false);

            directoryWatcher = new FileSystemWatcher {
                Path = inputFolderPath, NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite
            };
            directoryWatcher.Created += (sender, fileSystemEventArgs) => newFileEvent.Set();

            tokenSource           = new CancellationTokenSource();
            mergeTask             = new Task(() => WorkProcedure(tokenSource.Token));
            monitoreTask          = new Task(() => messageService.MonitoreClient(tokenSource.Token, stopWorkEvent));
            sendQueueSettingsTask = new Task(() => messageService.SendSettings(tokenSource.Token));

            messageService = new MessageService();
        }
Ejemplo n.º 9
0
        private static void Main()
        {
            HostFactory.Run(serviceConfig =>
            {
                serviceConfig.UseNLog();
                serviceConfig.SetServiceName("AwesomeFileConverter");
                serviceConfig.SetDisplayName("Awesome File Converter");
                serviceConfig.SetDescription("A Pluralsight demo service.");
                serviceConfig.Service <ConverterService>(serviceInstance =>
                {
                    serviceInstance.ConstructUsing(() => new ConverterService());
                    serviceInstance.WhenStarted(execute => execute.Start());
                    serviceInstance.WhenStopped(execute => execute.Stop());
                    serviceInstance.WhenPaused(execute => execute.Pause());
                    serviceInstance.WhenContinued(execute => execute.Continue());
                    serviceInstance.WhenCustomCommandReceived(
                        (execute, hostControl, commandNumber) => execute.CustomCommand(commandNumber));
                });
                serviceConfig.EnablePauseAndContinue();

                serviceConfig.EnableServiceRecovery(recoveryConfig =>
                {
                    recoveryConfig.RestartService(1);
                    recoveryConfig.RestartService(1);
                    recoveryConfig.RestartService(1);
                });

                serviceConfig.OnException(exception =>
                                          HostLogger.Get("Unhandled Exception").Fatal(exception));

                serviceConfig.StartAutomatically();
                serviceConfig.RunAsLocalService();
            });
        }
Ejemplo n.º 10
0
        public AmbiLightService(string configPath)
        {
            _configPath = configPath;
            _logger     = HostLogger.Get <AmbiLightService>();

            _screenCaptureServiceProvider  = new ScreenCaptureServiceProvider();
            _colorAveragingServiceProvider = new ColorAveragingServiceProvider();
            _colorTransformerService       = new ColorTransformerService();

            AmbiLightConfig config = ReadConfig(_configPath);

            ApplyConfig(config);

            var configFileInfo = new FileInfo(configPath);
            var watcher        = new FileSystemWatcher(configFileInfo.DirectoryName, configFileInfo.Name);

            watcher.Changed += (sender, eventArgs) =>
            {
                watcher.EnableRaisingEvents = false;
                while (FileIsLocked(eventArgs.FullPath))
                {
                    Thread.Sleep(100);
                }
                ReloadConfig();
                watcher.EnableRaisingEvents = true;
            };
            watcher.EnableRaisingEvents = true;
        }
        public HttpSelfHostServer Build()
        {
            var log = HostLogger.Get(typeof(WebApiConfigurator));

            var baseAddress = new UriBuilder(Scheme, Domain, Port).Uri;

            log.Debug(string.Format("[Topshelf.WebApi] Configuring WebAPI Selfhost for URI: {0}", baseAddress));

            var config = new HttpSelfHostConfiguration(baseAddress);

            if (DependencyResolver != null)
            {
                config.DependencyResolver = DependencyResolver;
            }

            if (ServerConfigurer != null)
            {
                ServerConfigurer(config);
            }

            if (RouteConfigurer != null)
            {
                RouteConfigurer(config.Routes);
            }

            Server = new HttpSelfHostServer(config);

            log.Info(string.Format("[Topshelf.WebApi] WebAPI Selfhost server configurated and listening on: {0}", baseAddress));

            return(Server);
        }
Ejemplo n.º 12
0
        private bool Initialize()
        {
            try
            {
                _status          = ProcessingStatus.Initialization;
                _fileQueueName   = ConfigurationManager.AppSettings["FileQueueName"];
                _sequanceTime    = int.Parse(ConfigurationManager.AppSettings["SequanceTime"]);
                _outputDirectory = ConfigurationManager.AppSettings["OutputDirectory"];
                _trashDirectory  = ConfigurationManager.AppSettings["TrashDirectory"];
                _queuesQueueName = ConfigurationManager.AppSettings["QueuesQueueName"];
                if (!Directory.Exists(_outputDirectory))
                {
                    Directory.CreateDirectory(_outputDirectory);
                }

                RestorePreviousSession();
                _status = ProcessingStatus.Idle;
                Task.Run(() => ProcessFiles(_cancelationSource.Token));
            }
            catch (Exception e)
            {
                HostLogger.Get <ProcessingService>().Error(e.Message);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 13
0
        private void GeneratePdfFile(Guid agentId, List <string> imageNames, CancellationToken cancelToken)
        {
            _status = ProcessingStatus.PdfFileGeneration;
            using (var pdfFile = new PdfDocument())
            {
                foreach (var imageName in imageNames)
                {
                    HostLogger.Get <ProcessingService>().Info($"Adding of file: {imageName}");
                    var page = pdfFile.AddPage();
                    var gfx  = XGraphics.FromPdfPage(page);
                    using (var image = XImage.FromFile(imageName))
                    {
                        var imageWidth  = (double)(image.PixelWidth < page.Width ? image.PixelWidth : page.Width);
                        var imageHeight = (imageWidth / image.PixelWidth) * image.PixelHeight;
                        gfx.DrawImage(image, 0, 0, imageWidth, imageHeight);
                    }

                    cancelToken.ThrowIfCancellationRequested();
                }

                HostLogger.Get <ProcessingService>().Info("Pdf generation finished...");
                var agentName     = agentId.ToString().Substring(32, 4);
                var resultPdfFile = Path.Combine(_outputDirectory,
                                                 $"{DateTime.Now:yyyy-MMMM-dd(HH-mm-ss)} - agent {agentName}.pdf");
                HostLogger.Get <ProcessingService>().Info($"Pdf file saving: \n {resultPdfFile}");
                pdfFile.Save(resultPdfFile);
                _pdfCount++;
            }

            _status = ProcessingStatus.Idle;
        }
Ejemplo n.º 14
0
        private void SequanceProcess(Guid agentId, CancellationToken cancelToken)
        {
            try
            {
                var agentQueueName = GetAgentQueueName(agentId);
                HostLogger.Get <ProcessingService>().Info("Pdf generation started...");
                using (var agentQueue = new System.Messaging.MessageQueue(agentQueueName, QueueAccessMode.Receive))
                {
                    agentQueue.Formatter = new XmlMessageFormatter(new[] { typeof(string) });
                    var imageNamesMessages = agentQueue.GetAllMessages();
                    if (!imageNamesMessages.Any())
                    {
                        return;
                    }

                    var imageNames = imageNamesMessages.Select(x => x.Body as string).ToList();
                    GeneratePdfFile(agentId, imageNames, cancelToken);
                    RemoveProcessedItems(imageNames, agentQueue);
                }
            }
            catch (Exception e)
            {
                HostLogger.Get <ProcessingService>().Error(e.Message);
            }

            _status = ProcessingStatus.Idle;
        }
Ejemplo n.º 15
0
        private void ProcessFile(string sourceFilePath, string fileName)
        {
            var resultFilePath = Path.Combine(_outputDirectory, fileName);

            if (sourceFilePath != resultFilePath)
            {
                resultFilePath = MoveWithRenaming(sourceFilePath, resultFilePath);
            }

            if (IsFileValid(resultFilePath))
            {
                lock (_fileSeqence)
                {
                    _fileSeqence.Add(resultFilePath);
                }
            }
            else
            {
                var trashFilePath = Path.Combine(_trashDirectory, fileName);
                MoveWithRenaming(resultFilePath, trashFilePath);
            }

            _sequanceCountdown.Change(_sequanceTime, _sequanceTime);
            HostLogger.Get <DocumentControlSystemService>().Info("Success");
        }
Ejemplo n.º 16
0
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterInstance(AutofacService.Instance)
            .As <IDependencyResolver>()
            .SingleInstance();

            builder.RegisterType <ScheduledJobsContext>()
            .Keyed <ScheduledJobsContext>(DataSourceType.CoreScheduledJobs);

            builder.RegisterType <ScheduledJobsContext>()
            .As <DbContext>()
            .Keyed <DbContext>(DataSourceType.CoreScheduledJobs)
            .InstancePerLifetimeScope();

            builder.Register((x, y) => new EntityFrameworkDataSource(x.ResolveKeyed <ScheduledJobsContext>(DataSourceType.CoreScheduledJobs)))
            .Keyed <IDataSource>(DataSourceType.CoreScheduledJobs);

            builder.Register((x, y) => new GenericRepository(x.ResolveKeyed <IDataSource>(DataSourceType.CoreScheduledJobs)))
            .Keyed <GenericRepository>(DataSourceType.CoreScheduledJobs);

            builder.Register((x, y) => new GenericRepository(x.ResolveKeyed <IDataSource>(DataSourceType.CoreScheduledJobs)))
            .Keyed <IGenericRepository>(DataSourceType.CoreScheduledJobs)
            .As <IGenericRepository>();

            builder.Register((x, y) => new GenericRepository(x.ResolveKeyed <IDataSource>(DataSourceType.CoreScheduledJobs)))
            .Keyed <IAsyncGenericRepository>(DataSourceType.CoreScheduledJobs)
            .As <IAsyncGenericRepository>();

            builder.Register((x, y) => new Scheduler(x.ResolveKeyed <IAsyncGenericRepository>(DataSourceType.CoreScheduledJobs)))
            .As <IScheduler>();

            builder.RegisterInstance(HostLogger.Get <ScheduledJobsService>())
            .As <LogWriter>()
            .SingleInstance();
        }
Ejemplo n.º 17
0
        internal static void Configure()
        {
            var rc = HostFactory.Run(configure =>
            {
                configure.UseLog4Net("..\\..\\App.config");
                HostLogger.Get <Program>().Info("Servizio in fase di avvio");
                Console.WriteLine("Servizio in fase di avvio");
                configure.Service <WindowsService>(service =>
                {
                    service.ConstructUsing(s => new WindowsService());
                    service.WhenStarted(s => s.Start());
                    service.WhenStopped(s => s.Stop());
                });

                configure.RunAsLocalSystem();
                configure.SetServiceName("PianificazioneService");
                configure.SetDisplayName("PianificazioneService");
                configure.SetDescription("Servizio di pianificazione da RVL di Metalplus");
                HostLogger.Get <Program>().Info("Servizio avviato");
                Console.WriteLine("Servizio in fase di avvio");
                configure.StartAutomatically();
            });

            var exitCode = (int)Convert.ChangeType(rc, rc.GetTypeCode());

            Environment.ExitCode = exitCode;
        }
Ejemplo n.º 18
0
        public BackendRootService(Bundle bundle, EventHub hub)
        {
            Bundle = bundle;
            Hub    = hub;

            Logger = HostLogger.Get <BackendRootService>();
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Configures a service.
        /// </summary>
        /// <param name="container">An Autofac container.</param>
        /// <returns>
        /// Returns a host instance.
        /// </returns>
        private static Host ConfigureHost(IContainer container)
        {
            var settings = container.Resolve <ISeekerSettings>();

            var host = HostFactory.New(x =>
            {
                x.EnableShutdown();
                x.RunAsLocalSystem();
                x.SetServiceName("Seeker");
                x.SetDisplayName("Seeker");
                x.SetDescription("Collects log messages");
                x.StartAutomatically();

                x.Service <SeekerService>(cfg =>
                {
                    cfg.ConstructUsing(() => container.Resolve <SeekerService>());
                    cfg.WhenStarted <SeekerService>(srv => srv.Start());
                    cfg.WhenStopped <SeekerService>(srv => srv.Stop());

                    cfg.WithNancyEndpoint(x, c =>
                    {
                        c.AddHost(port: settings.Port);
                        c.CreateUrlReservationsOnInstall();
                        c.Bootstrapper = new SeekerBootstrapper(AutofacContext.Container);
                    });
                });
                x.EnableServiceRecovery(cfg => cfg.RestartService(1));
                x.UseNLog();
                x.OnException(ex => HostLogger.Get("Seeker")
                              .Error("Unhandled exception.", ex));
            });

            return(host);
        }
Ejemplo n.º 20
0
        /// <summary>
        ///   Configures a new service host
        /// </summary>
        /// <param name="configureCallback"> Configuration method to call </param>
        /// <returns> A Topshelf service host, ready to run </returns>
        public static Host New(Action <HostConfigurator> configureCallback)
        {
            if (configureCallback == null)
            {
                throw new ArgumentNullException("configureCallback");
            }

            var configurator = new HostConfiguratorImpl();

            Type declaringType = configureCallback.Method.DeclaringType;

            if (declaringType != null)
            {
                string defaultServiceName = declaringType.Namespace;
                if (!string.IsNullOrEmpty(defaultServiceName))
                {
                    configurator.SetServiceName(defaultServiceName);
                }
            }

            configureCallback(configurator);

            configurator.ApplyCommandLine();

            ConfigurationResult result = ValidateConfigurationResult.CompileResults(configurator.Validate());

            if (result.Message.Length > 0)
            {
                HostLogger.Get(typeof(HostFactory))
                .InfoFormat("Configuration Result:\n{0}", result.Message);
            }

            return(configurator.CreateHost());
        }
Ejemplo n.º 21
0
        public Host CreateHost()
        {
            Type type = typeof(HostFactory);

            HostLogger.Get <HostConfiguratorImpl>()
            .InfoFormat("{0} v{1}, .NET Framework v{2}", type.Namespace, type.Assembly.GetName().Version,
                        Environment.Version);

            EnvironmentBuilder environmentBuilder = _environmentBuilderFactory(this);

            HostEnvironment environment = environmentBuilder.Build();

            ServiceBuilder serviceBuilder = _serviceBuilderFactory(_settings);

            HostBuilder builder = _hostBuilderFactory(environment, _settings);

            foreach (HostBuilderConfigurator configurator in _configurators)
            {
                builder = configurator.Configure(builder);
            }

            try
            {
                return(builder.Build(serviceBuilder));
            }
            //Intercept exceptions from serviceBuilder, TopShelf handling is in HostFactory
            catch (Exception ex)
            {
                builder.Settings?.ExceptionCallback(ex);
                throw;
            }
        }
Ejemplo n.º 22
0
 private AxDeviceWrapper(CZKEMClass axCZKEM)
 {
     Device          = axCZKEM;
     _logger         = HostLogger.Get <AxDeviceWrapper>();
     _timer          = new System.Timers.Timer(1000);
     _timer.Elapsed += OnElapsed;
 }
Ejemplo n.º 23
0
        private bool Initialize()
        {
            try
            {
                _remoteControlQueueName = ConfigurationManager.AppSettings["RemoteControlQueueName"];
                _fileQueueName          = ConfigurationManager.AppSettings["FileQueueName"];
                _trashDirectory         = ConfigurationManager.AppSettings["TrashDirectory"];
                _processedDirectory     = ConfigurationManager.AppSettings["ProcessedDirectory"];
                var targetDirectories = ConfigurationManager
                                        .AppSettings["TargetDirectories"]
                                        .Split(';')
                                        .Select(x => x.Trim())
                                        .ToList();
                InitializeFolders(targetDirectories);
                ProcessFolders(targetDirectories);
                InitializeWatchers(targetDirectories);
            }
            catch (Exception e)
            {
                HostLogger.Get <DocumentControlSystemService>().Error(e.Message);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 24
0
        public Bundle(SqliteConnector db, IWebApiConnector api)
        {
            Database = db;
            WebApi   = api;

            Logger = HostLogger.Get <Bundle>();
        }
Ejemplo n.º 25
0
        private static void ConfigureJob <T>(ServiceConfigurator <T> configurator, Action <JobConfigurator> jobConfigurator, bool replaceJob = false) where T : class
        {
            var log = HostLogger.Get(typeof(ScheduleJobServiceConfiguratorExtensions));

            var jobConfig = new JobConfigurator();

            jobConfigurator(jobConfig);

            if ((jobConfig.JobEnabled == null || jobConfig.JobEnabled()) && jobConfig.Job != null && jobConfig.Triggers != null)
            {
                var jobDetail   = jobConfig.Job();
                var jobTriggers = jobConfig.Triggers.Select(triggerFactory => triggerFactory()).Where(trigger => trigger != null).ToHashSet()
#if NET452
                                  .ToArray()
#endif
                ;

                async Task BeforeStartingServiceFunc()
                {
                    log.Debug("[Topshelf.Quartz] Scheduler starting up...");

                    var scheduler = await GetScheduler();

                    if (scheduler != null && jobDetail != null && jobTriggers.Any())
                    {
                        await scheduler.ScheduleJob(jobDetail, jobTriggers, replaceJob);

                        log.Info($"[Topshelf.Quartz] Scheduled Job: {jobDetail.Key} of Type: {jobDetail.JobType.Name}");

                        foreach (var trigger in jobTriggers)
                        {
                            log.Info($"[Topshelf.Quartz] Job Schedule: {trigger} - Next Fire Time (local): {trigger.GetNextFireTimeUtc()?.ToLocalTime().ToString() ?? "none"}");
                        }

                        await scheduler.Start();

                        log.Info("[Topshelf.Quartz] Scheduler started...");
                    }
                }

                async Task BeforeStoppingServiceFunc()
                {
                    log.Debug("[Topshelf.Quartz] Scheduler shutting down...");
                    var scheduler = await GetScheduler();

                    if (scheduler != null)
                    {
                        if (!scheduler.IsShutdown)
                        {
                            await scheduler.Shutdown();
                        }
                    }
                    log.Info("[Topshelf.Quartz] Scheduler shut down...");
                }

                configurator.BeforeStartingService(async() => await BeforeStartingServiceFunc());
                configurator.BeforeStoppingService(async() => await BeforeStoppingServiceFunc());
            }
        }
Ejemplo n.º 26
0
        public static HostConfigurator UseNinject(this HostConfigurator configurator, INinjectSettings settings)
        {
            var log = HostLogger.Get("Default");

            log.Info("[Topshelf.Ninject] 开始整合到宿主中");
            configurator.AddConfigurator(new NinjectBuilderConfigurator(settings));
            return(configurator);
        }
Ejemplo n.º 27
0
        public static string MoveWithRenaming(string sourceFilePath, string resultFilePath)
        {
            resultFilePath = GetUniqueName(sourceFilePath, resultFilePath);
            HostLogger.Get <DocumentControlSystemService>().Info($"Moving of file started:\n {sourceFilePath}\n ->\n {resultFilePath}");

            File.Move(sourceFilePath, resultFilePath);
            return(resultFilePath);
        }
        public ZKTecoServiceControl(SqliteConnector connector, EventHub hub)
        {
            _db  = connector;
            _hub = hub;

            _signal = new ManualResetEvent(false);
            Logger  = HostLogger.Get <ZKTecoServiceControl>();
        }
Ejemplo n.º 29
0
        internal static void SetupAbp()
        {
            var log = HostLogger.Get(typeof(AbpScheduleJobServiceConfiguratorExtensions));

            ScheduleJobServiceConfiguratorExtensions.SchedulerFactory = () => IocManager.Instance.Resolve <ISchedulerFactory>().GetScheduler();

            log.Info("[Topshelf.Quartz.Abp] Quartz configured to construct jobs with Abp.");
        }
        public static HostConfigurator UseAbp(this HostConfigurator configurator, AbpBootstrapper abpBootstrapper)
        {
            var log = HostLogger.Get(typeof(HostConfiguratorExtensions));

            log.Info("[Topshelf.Abp] Integration Started in host.");

            configurator.AddConfigurator(new AbpBuilderConfigurator(abpBootstrapper));
            return(configurator);
        }