public ActionResult Heartbeat()
        {
            // Re-Load the configuration
            ConfigurationService.Load();

            // Log the service state
            LogService.Info("Heartbeat requested!");

            // Hangfire
            HangfireBootstrapper.Instance.Start();

            // Log the service state
            LogService.Info("Hangfire re-started!");

            // Register the main job
            RecurringJob.AddOrUpdate("Daily Job Registration", () => HangfireService.UpdateJobs(), Cron.Daily);

            // Log the service state
            LogService.Info("Daily job registration service updated! Lub-dub!");

            return(Json("lub-dub", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Load the configuration
            ConfigurationService.Load();

            // Log the application initialization
            LogService.Debug("Lidia Scheduler UI initialized");

            // Hangfire
            HangfireBootstrapper.Instance.Start();

            // Register the main job
            RecurringJob.AddOrUpdate("Daily Job Registration", () => HangfireService.UpdateJobs(), Cron.Daily);

            #region [ Dependency Injection ]

            // Create the container as usual.
            var container = new ServiceContainer();
            var lifeTime  = new PerRequestLifeTime();

            // Register your types, for instanceScoped);
            container.Register <ITenantService, TenantService>(lifeTime);
            container.Register <IUserService, UserService>(lifeTime);
            container.Register <ISchedulerService, SchedulerService>(lifeTime);

            container.RegisterControllers();

            container.EnableMvc();

            #endregion
        }