public bool Stop() { Bus?.Stop(); _backgroundJobServer.Dispose(); return(true); }
public void Stop() { lock (_lockObject) { if (_backgroundJobServer != null) { _backgroundJobServer.Dispose(); } HostingEnvironment.UnregisterObject(this); } }
public void Stop(StopMessage msg) { //cleanup disposable resources if (timerRefreshFromWebApi != null) { timerRefreshFromWebApi.Stop(); timerRefreshFromWebApi.Dispose(); } if (hangfireServer != null) { hangfireServer.SendStop(); hangfireServer.Dispose(); } logger.Trace("LanCopyController Stopped"); }
public bool Stop(HostControl hostControl) { _webApplication.Dispose(); _jobServer.Dispose(); return(true); }
public Task StopAsync(CancellationToken cancellationToken) { _server.SendStop(); _server.Dispose(); _logger.LogInformation("Hangfire Stopped"); return(Task.CompletedTask); }
private static void MainHangfire() { BackgroundJobServer hangfire = null; try { System.Console.Clear(); System.Console.WriteLine("Hangfire"); System.Console.WriteLine("http://localhost:5000/hangfire"); GlobalConfiguration.Configuration.UseSqlServerStorage("hangfire"); hangfire = new BackgroundJobServer(); StartOptions options = new StartOptions(); //options.Urls.Add("http://localhost:5000"); //options.Urls.Add("http://127.0.0.1:5000"); //options.Urls.Add($"http://{Environment.MachineName}:5000"); WebApp.Start <Startup>(options); ProcessStartInfo process = new ProcessStartInfo("chrome.exe"); process.Arguments = "http://localhost:5000/hangfire"; Process.Start(process); System.Console.Write("\nPress <KEY> to continue... "); System.Console.ReadKey(); } finally { if (hangfire != null) { hangfire.Dispose(); } } }
public Task StopAsync(CancellationToken cancellationToken) { _logger.LogInformation("Stopping Hangfire job server."); _jobServer.Dispose(); return(Task.CompletedTask); }
public void Stop() { if (_backgroundServer != null) { _backgroundServer.Dispose(); } }
public void Stop() { Console.WriteLine("I stopped"); _backgroundJobServer.SendStop(); _backgroundJobServer.Dispose(); }
private static void Main() { GlobalConfiguration.Configuration.UseMemoryStorage(); var options = new BackgroundJobServerOptions { SchedulePollingInterval = TimeSpan.FromMilliseconds(10) }; var server = new BackgroundJobServer(options); var cb = new ContainerBuilder(); cb.RegisterType <EventBroker>().SingleInstance(); cb.RegisterType <ModelTimeScheduler>().InstancePerDependency(); cb.Register <Manager>((c, p) => new Manager( p.Named <ModelTimeScheduler>("timeScheduler"), c.Resolve <EventBroker>() )).SingleInstance(); cb.Register((c, p) => new Developer( p.Named <ModelTimeScheduler>("timeScheduler"), c.Resolve <EventBroker>(), p.Named <string>("name") )); using (var c = cb.Build()) { Run(c).Wait(); } server.Dispose(); }
public void DisposeEngineService() { _jobServer?.Dispose(); _jobServer = null; Service?.Dispose(); Service = null; }
// GET: SMSAppRegistrations //public ActionResult Index() //{ // //var smsAppRegistration = db.SmsAppRegistration.Include(s => s.Constituency).Include(s => s.County) // // .Include(s => s.Gender).Include(s => s.MaritalStatus).Include(s => s.PWDCategory); // return View(); //} public void StartHangfire() { var server = new BackgroundJobServer(); // Wait for graceful server shutdown. server.Dispose(); }
/// <summary> /// Stops and disposes of the hangfire server instance. /// </summary> public void Stop() { if (_server != null) { _server.Dispose(); } }
public Task PostStop(IBus bus) { _server?.Dispose(); LogContext.Debug?.Log("Hangfire Scheduler Stopped: {InputAddress}", _schedulerEndpointAddress); return(TaskUtil.Completed); }
protected override void OnStop() { _server.Dispose(); using (System.IO.StreamWriter sw = new System.IO.StreamWriter(@"D:\log_Stop.txt", true)) { sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "Stop."); } }
public override void OnApplicationShutdown(ApplicationShutdownContext context) { if (_backgroundJobServer != null) { _backgroundJobServer.SendStop(); _backgroundJobServer.Dispose(); } }
protected override void OnStop() { _redisMQLog = new RedisMQLog { Title = "服务停止", Content = "大方工业云数据同步服务:【服务停止】", CDate = ToolMethods.GetNow() }; WriteLog(_redisMQLog); _server.Dispose(); }
public void Stop() { if (_server != null) { _server.Dispose(); } Log.Logger.Information(string.Format("##### :: Hangfire server stopped at: {0} :: #####", System.DateTime.UtcNow.ToString("dd MMM yyyy, hh:mm tt"))); }
protected override void OnStop() { _server.Dispose(); _host.Dispose(); if (serviceHost != null) { serviceHost.Close(); serviceHost = null; } }
public void Stop() { if (ConfigurationManager.AppSettings["DATA.PROVIDER"] == "System.Data.SqlClient") { _trtDependency.Stop(); _spoilDependency.Stop(); } _jobServer.Dispose(); }
public void Stop() { if (_appConfiguration.IsBackgroundTaskEnabled) { _logger.Info("Service queue is stopping."); _server.Dispose(); _logger.Info("Service queue stopped."); } else { _logger.Info("Service MSMQ is stopping."); _listener.CanProcess = false; while (!_isCompleted) { Thread.Sleep(2000); } _logger.Info("Service MSMQ stopped."); } }
void IDisposable.Dispose() { try { if (_server != null) { _server.Dispose(); } } catch { } }
protected override void OnStop() { if (apiserver != null) { apiserver.Dispose(); } _hangfire_server.Dispose(); Trace.Write("Hangfire Service Stop..."); }
//private static BackgroundJobServer _jobServer; static void Main(string[] args) { Console.WriteLine("Starting hellokube.service"); var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true) .AddJsonFile("config/externalsettings.json", optional: false); Configuration = builder.Build(); Console.WriteLine($"Connecting to: {Configuration["RabbitMQ:Uri"]}"); GlobalConfiguration.Configuration.UseSqlServerStorage(Configuration["SqlServer:ConnectionString"]); BackgroundJobServer _jobServer = new BackgroundJobServer(); // Fire and forget Task.Run(() => { _bus = Bus.Factory.CreateUsingRabbitMq(sbc => { var host = sbc.Host(new Uri(Configuration["RabbitMQ:Uri"]), h => { h.Username(Configuration["RabbitMQ:UserName"]); h.Password(Configuration["RabbitMQ:Password"]); }); }); _bus.Start(); var redisConnString = Configuration["Redis:ConnectionString"]; HelloKube.core.services.CacheService.ConnectionString = redisConnString; jobs.ServerTimeJob stj = new jobs.ServerTimeJob(); RecurringJob.AddOrUpdate("rmq-sample-job", () => stj.Execute(), Cron.Minutely, TimeZoneInfo.Local); jobs.CacheCountryListJob cclj = new jobs.CacheCountryListJob(); RecurringJob.AddOrUpdate("cache-country-list-job", () => cclj.Execute(), Cron.MinuteInterval(5)); }); // Handle Control+C or Control+Break Console.CancelKeyPress += (o, e) => { Console.WriteLine("Exit"); _bus.Stop(); _jobServer.Dispose(); // Allow the manin thread to continue and exit... waitHandle.Set(); }; // Wait waitHandle.WaitOne(); }
private void Teardown() { if (TeardownPerformed) { return; } _server?.Dispose(); _webApp?.Dispose(); TeardownPerformed = true; }
static async Task Main() { #region serilog Log.Logger = new LoggerConfiguration() .WriteTo.ColoredConsole() .CreateLogger(); LogManager.Use <SerilogFactory>(); #endregion Console.Title = "Samples.HangfireScheduler.Scheduler"; var endpointConfiguration = new EndpointConfiguration("Samples.HangfireScheduler.Scheduler"); endpointConfiguration.UseTransport <LearningTransport>(); #region Configuration var endpointInstance = await Endpoint.Start(endpointConfiguration) .ConfigureAwait(false); // store the endpointInstance in a static helper class EndpointHelper.Instance = endpointInstance; // use in memory storage. Production should use more robust alternatives: // SqlServer, Msmq, Redis etc GlobalConfiguration.Configuration.UseMemoryStorage(); // create and start scheduler instance var scheduler = new BackgroundJobServer(); #endregion #region scheduleJob // Tell Hangfire to schedule the job and trigger every minute RecurringJob.AddOrUpdate("myJob", () => SendMessageJob.Run(), Cron.Minutely); #endregion Console.WriteLine("Press any key to exit"); Console.ReadKey(); #region shutdown scheduler.Dispose(); await endpointInstance.Stop() .ConfigureAwait(false); Log.CloseAndFlush(); #endregion }
public void Stop() { // shut down the background processor _logger.Info("Shutting down background job server"); _jobServer.Dispose(); // shut down the Nancy host _logger.Info("Shutting down Nancy host"); _host.Stop(); _host.Dispose(); _logger.Info("IISLogReader Service stopped"); }
public void Stop() { logger.Warn("PROCESO AUTOMATICO: Esta instancia esta DETENIENDO el Servicio de Ejecucion Automatica de los procesos"); lock (_lockObject) { if (_backgroundJobServer != null) { _backgroundJobServer.Dispose(); } HostingEnvironment.UnregisterObject(this); } }
public bool Stop(HostControl hostControl) { if (_busHandle != null) { _busHandle.Stop(); } if (hangfireServer != null) { hangfireServer.Dispose(); } return(true); }
public static void Stop() { if (_serverA != null) { _serverA.Stop(); _serverA.Dispose(); } if (_serverB != null) { _serverB.Stop(); _serverB.Dispose(); } }