Пример #1
0
 public static string Updater(JobSettings s)
 {
     return(Get(s.AutomaticUpdater, Cron.HourInterval(6)));
 }
Пример #2
0
        public void Start()
        {
            lock (_lockObject)
            {
                if (_started)
                {
                    return;
                }
                _started = true;


                HostingEnvironment.RegisterObject(this);

                GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");

                _backgroundJobServer = new BackgroundJobServer();

                RecurringJob.AddOrUpdate("Chequear Medidas", () => this.CheckAsync(), cronExpression: Cron.HourInterval(1));
            }
        }
Пример #3
0
        public void Configuration(IAppBuilder app)
        {
            AreaRegistration.RegisterAllAreas();
            System.Web.Http.GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            // Start unity
            var unityContainer = UnityHelper.Start();

            // Set Hangfire to use SQL Server and the connection string
            GlobalConfiguration.Configuration.UseSqlServerStorage(SiteConstants.Instance.MvcForumContext);

            // Make hangfire use unity container
            GlobalConfiguration.Configuration.UseUnityActivator(unityContainer);

            // Add Hangfire
            // TODO - Do I need this dashboard?
            //app.UseHangfireDashboard();
            app.UseHangfireServer();

            // Make DB update to latest migration
            Database.SetInitializer(new MigrateDatabaseToLatestVersion <MvcForumContext, Configuration>());

            // Get services needed
            var mvcForumContext   = DependencyResolver.Current.GetService <IMvcForumContext>();
            var badgeService      = DependencyResolver.Current.GetService <IBadgeService>();
            var settingsService   = DependencyResolver.Current.GetService <ISettingsService>();
            var loggingService    = DependencyResolver.Current.GetService <ILoggingService>();
            var reflectionService = DependencyResolver.Current.GetService <IReflectionService>();

            // Routes
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            // If the same carry on as normal
            loggingService.Initialise(ConfigUtils.GetAppSettingInt32("LogFileMaxSizeBytes", 10000));
            loggingService.Error("START APP");

            // Get assemblies for badges, events etc...
            var loadedAssemblies = reflectionService.GetAssemblies();

            // Do the badge processing
            try
            {
                badgeService.SyncBadges(loadedAssemblies);
                mvcForumContext.SaveChanges();
            }
            catch (Exception ex)
            {
                loggingService.Error($"Error processing badge classes: {ex.Message}");
            }

            // Set the view engine
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new ForumViewEngine(settingsService.GetSettings().Theme));

            // Initialise the events
            EventManager.Instance.Initialize(loggingService, loadedAssemblies);

            // Finally trigger any Cron jobs
            RecurringJob.AddOrUpdate <RecurringJobService>(x => x.SendMarkAsSolutionReminders(), Cron.HourInterval(6), queue: "solutionreminders");
        }
Пример #4
0
 public void HourInterval(int interval)
 {
     cronString = Cron.HourInterval(interval);
 }
Пример #5
0
 public void UpdateCommunityVideos()
 {
     RecurringJob.AddOrUpdate(() => UpdateCommunityVideosOnDisk(), Cron.HourInterval(1));
 }
Пример #6
0
 public void CreateJobForProjectForceSubmit(Guid projectId)
 {
     RecurringJob.AddOrUpdate <IProjectSupplementAppService>($"projectforcesubmit-{projectId}", x => x.JobForProjectForceSubmit(projectId), Cron.HourInterval(2));
 }
Пример #7
0
        private void CreateRecurringJob(List <PriorityModel> list)
        {
            foreach (var item in list)
            {
                switch (item.PriorityName)
                {
                case "A":
                    RecurringJob.AddOrUpdate(() => GetTablePriorityRecords1(item.ID), Cron.HourInterval(Convert.ToInt32(item.Frequency)));
                    break;

                case "B":
                    RecurringJob.AddOrUpdate(() => GetTablePriorityRecords2(item.ID), Cron.HourInterval(Convert.ToInt32(item.Frequency)));
                    break;

                case "C":
                    RecurringJob.AddOrUpdate(() => GetTablePriorityRecords3(item.ID), Cron.HourInterval(Convert.ToInt32(item.Frequency)));
                    break;

                default:
                    break;
                }
            }
        }
Пример #8
0
        public static void ConfigureHangfire(IContainer container)
        {
            GlobalConfiguration.Configuration.UseSqlServerStorage("IposSyncContext");

            GlobalConfiguration.Configuration.UseActivator(new IposContainerJobActivator(container));

#if DEBUG
            RecurringJob.AddOrUpdate <ProcessFreshTransactionWorkflow>(workflow => workflow.TriggerOfflineTableSync(), Cron.MinuteInterval(1));

            RecurringJob.AddOrUpdate <ProcessFreshTransactionWorkflow>(workflow => workflow.SyncBatchToCloud(), Cron.MinuteInterval(2));

            RecurringJob.AddOrUpdate <ProcessSpoilWorkflow>(workflow => workflow.TriggerOfflineTableSync(), Cron.MinuteInterval(1));

            RecurringJob.AddOrUpdate <ProcessSpoilWorkflow>(workflow => workflow.SyncBatchToCloud(), Cron.MinuteInterval(2));
#else
            RecurringJob.AddOrUpdate <ProcessFreshTransactionWorkflow>(workflow => workflow.TriggerOfflineTableSync(), Cron.MinuteInterval(45));

            RecurringJob.AddOrUpdate <ProcessFreshTransactionWorkflow>(workflow => workflow.SyncBatchToCloud(), Cron.HourInterval(1));

            RecurringJob.AddOrUpdate <ProcessSpoilWorkflow>(workflow => workflow.TriggerOfflineTableSync(), Cron.HourInterval(24));

            RecurringJob.AddOrUpdate <ProcessSpoilWorkflow>(workflow => workflow.SyncBatchToCloud(), Cron.HourInterval(25));
#endif
        }
        public string DecisionPointJobCall(string id, string jobId, string hourInterval)
        {
            base.DecisionPointJobCallBase(id, jobId, hourInterval);

            RecurringJob.AddOrUpdate <PurchasingWorkFlowProcessService>(jobId, x => x.DecisionPointTakeTheNextStep(int.Parse(id)), Cron.HourInterval(int.Parse(hourInterval)));
            return("OK");
        }
Пример #10
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider, ILoggerFactory loggerFactory)
        {
            app.UseSession();

            loggerFactory.AddFile(Configuration.GetSection("Logging:PathFormat").Value,
                                  retainedFileCountLimit: Convert.ToInt32(Configuration.GetSection("Logging:RetainedFileCountLimit").Value),
                                  minimumLevel: (LogLevel)Enum.Parse(typeof(LogLevel), Configuration.GetSection("Logging:LogLevel:Default").Value));

            serviceProvider.GetService <DatabaseInitializer>().Initialize();

            if (env.IsDevelopment())
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true
                });
                //app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStatusCodePagesWithRedirects("/Home/Error/{0}");
            //app.UseStatusCodePages();
            var options = new RewriteOptions()
                          .AddRedirectToHttps();

            app.UseRewriter(options);

            GlobalConfiguration.Configuration.UseActivator(new HangfireActivator(serviceProvider));
            app.UseHangfireServer();
            app.UseHangfireDashboard();
            var interval = int.Parse(Configuration.GetSection("HangfireScheduler")["ImportIntervalInHours"]);

            RecurringJob.AddOrUpdate <IExternalPostService>("facebook", x => x.ImportPostsAsync("facebook"), Cron.HourInterval(interval));
            RecurringJob.AddOrUpdate <IExternalPostService>("sharepoint", x => x.ImportPostsAsync("sharepoint"), Cron.HourInterval(interval));
            app.UseStaticFiles();
            app.UseAuthentication();
            if (env.IsDevelopment())
            {
                app.UseSwagger();
                app.UseSwaggerUI(c =>
                {
                    c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
                });
            }

            app.Map("/getDefaultPostDuration", duration =>
            {
                duration.Run(async context =>
                {
                    if (context.User.Identity.IsAuthenticated)
                    {
                        context.Response.Headers.Add("duration", (Configuration.GetSection("PostDefaultValues")["DurationInSeconds"]));
                    }
                    else
                    {
                        context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
                    }
                });
            });

            app.Map("/getDefaultPostEndDate", duration =>
            {
                duration.Run(async context =>
                {
                    if (context.User.Identity.IsAuthenticated)
                    {
                        context.Response.Headers.Add("enddateforAdmins", (Configuration.GetSection("PostDefaultValues")["DisplayPeriodInDaysForAdmins"]));
                        context.Response.Headers.Add("enddateforUsers", (Configuration.GetSection("PostDefaultValues")["DisplayPeriodInDaysForUsers"]));
                    }
                    else
                    {
                        context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
                    }
                });
            });


            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });
        }
Пример #11
0
 public static string PlexContent(JobSettings s)
 {
     return(Get(s.PlexContentSync, Cron.HourInterval(6)));
 }
Пример #12
0
        /// <summary>
        /// </summary>
        protected override void InitModuleCustom()
        {
            _thisModule = this;

            /*
             * Обслуживание индексов запускаем один раз при старте и раз в несколько часов
             * */
            TasksManager.SetTask(typeof(FileManager).FullName + "_" + nameof(MaintenanceIndexes), DateTime.Now.AddSeconds(30), () => MaintenanceIndexesStatic());
            TasksManager.SetTask(typeof(FileManager).FullName + "_" + nameof(MaintenanceIndexes) + "_hourly6", Cron.HourInterval(6), () => MaintenanceIndexesStatic());

            /*
             * Прекомпиляция шаблонов при запуске.
             * */
            //if (!Debug.IsDeveloper)
            //    Tasks.TasksManager.SetTask(typeof(Module).FullName + "_" + nameof(RazorPrecompilationStatic), DateTime.Now.AddMinutes(1), () => RazorPrecompilationStatic());

#if DEBUG
            /*
             * Регулярная сборка мусора для сборки в режиме отладки.
             * */
            TasksManager.SetTask(typeof(FileManager).FullName + "_" + nameof(GCCollect) + "_minutely1", Cron.MinuteInterval(1), () => GCCollectStatic());
#endif

            TasksManager.SetTask(typeof(FileManager).FullName + "_" + nameof(PlaceFileIntoQueue) + "_0", DateTime.Now.AddSeconds(10), () => PlaceFileIntoQueue());
            TasksManager.SetTask(typeof(FileManager).FullName + "_" + nameof(PlaceFileIntoQueue) + "_minutely5", Cron.MinuteInterval(5), () => PlaceFileIntoQueue());

            // Не запускать не машине разработчика, иначе может быть так, что при подключении базе на удаленном сервере файлы физически останутся, а из базы будут удалены.
            if (!Debug.IsDeveloper)
            {
                TasksManager.SetTask(typeof(FileManager).FullName + "_" + nameof(RemoveMarkedFiles) + "_0", DateTime.Now.AddSeconds(10), () => RemoveMarkedFiles());
                TasksManager.SetTask(typeof(FileManager).FullName + "_" + nameof(RemoveMarkedFiles) + "_minutely1", Cron.MinuteInterval(1), () => RemoveMarkedFiles());
            }

            // Не запускать не машине разработчика, иначе может быть так, что при подключении базе на удаленном сервере файлы физически останутся, а из базы будут удалены.
            if (!Debug.IsDeveloper)
            {
                TasksManager.SetTask(typeof(FileManager).FullName + "_" + nameof(CheckRemovedFiles) + "_0", DateTime.Now.AddSeconds(10), () => CheckRemovedFiles(true));
            }

            ModelMetadataProviders.Current = new MVC.TraceModelMetadataProviderWithFiles();
        }
Пример #13
0
 public Task StartAsync()
 {
     RecurringJob.AddOrUpdate(JobId, () => SendMessage(), () => Cron.HourInterval(1));
     Process.Start("http://localhost:65238/hangfire/recurring");
     return(Task.FromResult(0));
 }
Пример #14
0
        public string ConvertToCronString()
        {
            switch (PatternType)
            {
            case PatternTypes.Hourly:
                Requires.NonNull(HourlyPattern, nameof(HourlyPattern));
                Requires.Valid(HourlyPattern, nameof(HourlyPattern));
                return(Cron.HourInterval(Convert.ToInt32(HourlyPattern.EveryNHours)));

            case PatternTypes.Daily:
                Requires.NonNull(DailyPattern, nameof(DailyPattern));
                Requires.Valid(DailyPattern, nameof(DailyPattern));
                if (DailyPattern.EveryNDays > 0)
                {
                    return(Cron.DayInterval(Convert.ToInt32(DailyPattern.EveryNDays)));
                }
                if (DailyPattern.EveryWeekday)
                {
                    var startTimeHour   = StartTimeUtc.Hour.ToString();
                    var startTimeMinute = StartTimeUtc.Minute.ToString();
                    return($"{startTimeMinute} {startTimeHour} * * 1-5");
                }
                break;

            case PatternTypes.Weekly:
                Requires.NonNull(WeeklyPattern, nameof(WeeklyPattern));
                Requires.Valid(WeeklyPattern, nameof(WeeklyPattern));

                if (WeeklyPattern.RecurEveryNWeeksOn == 1)
                {
                    var dayString = "";
                    //TODO: Test trailing comma
                    if (WeeklyPattern.Monday)
                    {
                        dayString += "1,";
                    }
                    if (WeeklyPattern.Tuesday)
                    {
                        dayString += "2,";
                    }
                    if (WeeklyPattern.Wednesday)
                    {
                        dayString += "3,";
                    }
                    if (WeeklyPattern.Thursday)
                    {
                        dayString += "4,";
                    }
                    if (WeeklyPattern.Friday)
                    {
                        dayString += "5,";
                    }
                    if (WeeklyPattern.Saturday)
                    {
                        dayString += "6,";
                    }
                    if (WeeklyPattern.Sunday)
                    {
                        dayString += "7,";
                    }

                    var startTimeHour   = StartTimeUtc.Hour.ToString();
                    var startTimeMinute = StartTimeUtc.Minute.ToString();

                    return($"{startTimeMinute} {startTimeHour} 12 ? * {dayString} *");
                }
                else
                {
                    throw new NotImplementedException();
                }

            case PatternTypes.Monthly:
                throw new NotImplementedException();

            case PatternTypes.Yearly:
                throw new NotImplementedException();

            default:
                throw new UnexpectedSwitchValueException(PatternType);
            }

            return("");
        }
Пример #15
0
        /// <summary>
        /// 初始化调度计划
        /// </summary>
        public bool Start()
        {
            try
            {
                FrameworkLog.LogModel.LogHelper.WriteInfoLog($"开始启动任务调度");
                tradeSyncContextService.BuildContext();
                syncList = tradeSyncContextService.SyncContext.Context;

                syncList.ForEach(x =>
                {
                    var syncService = new TradeSyncService(_constr);
                    x.TaskId        = Guid.NewGuid().ToString();
                    RecurringJob.AddOrUpdate(x.TaskId, () => syncService.DoJob(x.Shops), Cron.HourInterval(x.SyncPeriodHours));
                });
                FrameworkLog.LogModel.LogHelper.WriteInfoLog($"启动任务调度完毕");
                return(true);
            }
            catch (Exception ex)
            {
                FrameworkLog.LogModel.LogHelper.WriteErrorLog($"启动任务调度失败", ex);
                return(false);
            }
        }
Пример #16
0
        public void GenerateReleasesCache(PerformContext context)
        {
            var releasesService = new ReleasesService();

            RecurringJob.AddOrUpdate(() => releasesService.GenerateReleasesCache(context), Cron.HourInterval(1));
        }
Пример #17
0
 /// <summary>
 /// 根据用户重新载入任务
 /// </summary>
 /// <returns></returns>
 public bool ReloadByUserId(params int[] userIds)
 {
     try
     {
         var syncService = new TradeSyncService(_constr);
         tradeSyncContextService.BuildContext(userIds);
         var array = tradeSyncContextService.SyncContext;
         array.Context.ForEach(x =>
         {
             var tmp = syncList.Find(y => y.UserId == x.UserId);
             if (tmp != null)
             {
                 RecurringJob.RemoveIfExists(tmp.TaskId);
             }
             else
             {
                 x.TaskId = Guid.NewGuid().ToString();
                 syncList.Add(x);
             }
             RecurringJob.AddOrUpdate(x.TaskId, () => syncService.DoJob(x.Shops), Cron.HourInterval(x.SyncPeriodHours));
         });
         return(true);
     }
     catch (Exception ex)
     {
         FrameworkLog.LogModel.LogHelper.WriteErrorLog($"根据用户重新载入任务", ex);
         return(false);
     }
 }
Пример #18
0
 public void MarkAsSolvedReminder()
 {
     RecurringJob.AddOrUpdate(() => ScheduleTopics(), Cron.HourInterval(12));
 }
Пример #19
0
 /// <summary>
 /// 根据项目工时自动创建工作项到期待办提醒
 /// </summary>
 /// <param name="porjectId"></param>
 /// <param name="taskId"></param>
 public void CreatProjectProgressTask(Guid instancId, Guid taskId, int hours)
 {
     RecurringJob.AddOrUpdate <IProjectProgressComplateAppService>($"projectprocess-{taskId}", x => x.TimeOut(instancId, taskId), Cron.HourInterval(hours));
     //RecurringJob.AddOrUpdate<IProjectProgressComplateAppService>($"projectprocess-{instancId}", x => x.TimeOut(instancId, taskId), Cron.MinuteInterval(10));
 }
Пример #20
0
 public void UpdateGitHubContributors()
 {
     RecurringJob.AddOrUpdate(() => UpdateGitHubContributorsJsonFile(), Cron.HourInterval(12));
 }
Пример #21
0
        public void StartSyncTask()
        {
            var config = HttpHelp.RequsetAbp <SettingValue[]>(RequsetMethod.POST, "/api/services/app/Configuration/GetAppConfig", new string[] { "asyncInterval" }, null, false).Result;

            RecurringJob.AddOrUpdate("ErpSync", () => SyncReadyMBill(null), Cron.HourInterval(int.Parse(config.FirstOrDefault(c => c.Name == "asyncInterval").Value)));
        }
Пример #22
0
 public void UpdateCommunityBlogPosts()
 {
     RecurringJob.AddOrUpdate(() => UpdateBlogPostsJsonFile(null), Cron.HourInterval(1));
 }
Пример #23
0
        public void Configuration(IAppBuilder app)
        {
            AreaRegistration.RegisterAllAreas();
            System.Web.Http.GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            // Start unity
            UnityHelper.InitialiseUnityContainer();

            // Make DB update to latest migration
            Database.SetInitializer(new MigrateDatabaseToLatestVersion <MvcForumContext, Configuration>());

            // Set the rest of the Ioc
            UnityHelper.BuildUnityContainer();

            // Grab the container as we will need to use it
            var unityContainer = UnityHelper.Container;

            // Set Hangfire to use SQL Server and the connection string
            GlobalConfiguration.Configuration.UseSqlServerStorage(ForumConfiguration.Instance.MvcForumContext);

            // Make hangfire use unity container
            GlobalConfiguration.Configuration.UseUnityActivator(unityContainer);

            // Add Hangfire
            // TODO - Do I need this dashboard?
            //app.UseHangfireDashboard();
            app.UseHangfireServer();

            // Get services needed
            var mvcForumContext  = unityContainer.Resolve <IMvcForumContext>();
            var badgeService     = unityContainer.Resolve <IBadgeService>();
            var loggingService   = unityContainer.Resolve <ILoggingService>();
            var assemblyProvider = unityContainer.Resolve <IAssemblyProvider>();

            // Routes
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            // If the same carry on as normal
            var logFileSize = ForumConfiguration.Instance.LogFileMaxSizeBytes;

            loggingService.Initialise(logFileSize > 100000 ? logFileSize : 100000);
            loggingService.Error("START APP");

            // Find the plugin, pipeline and badge assemblies
            var assemblies = assemblyProvider.GetAssemblies(ForumConfiguration.Instance.PluginSearchLocations).ToList();

            ImplementationManager.SetAssemblies(assemblies);

            // Do the badge processing
            try
            {
                badgeService.SyncBadges(assemblies);
                mvcForumContext.SaveChanges();
            }
            catch (Exception ex)
            {
                loggingService.Error($"Error processing badge classes: {ex.Message}");
            }

            var theme    = "Metro";
            var settings = mvcForumContext.Setting.FirstOrDefault();

            if (settings != null)
            {
                theme = settings.Theme;
            }

            // Set the view engine
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new ForumViewEngine(theme));

            // Initialise the events
            EventManager.Instance.Initialize(loggingService, assemblies);

            // Finally trigger any Cron jobs
            RecurringJob.AddOrUpdate <RecurringJobService>(x => x.SendMarkAsSolutionReminders(), Cron.HourInterval(6), queue: "solutionreminders");
        }
Пример #24
0
 public void UpdateVimeoVideos()
 {
     RecurringJob.AddOrUpdate(() => UpdateVimeoJsonFile(), Cron.HourInterval(1));
 }
Пример #25
0
 public void GetGitHubPullRequests()
 {
     RecurringJob.AddOrUpdate(() => UpdatePullRequests(), Cron.HourInterval(1));
 }
Пример #26
0
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            ILoggerFactory loggerFactory
            )
        {
            app.UseAbp(options => { options.UseAbpRequestLocalization = false; }); // Initializes ABP framework.

            app.UseCors(_defaultCorsPolicyName);                                   // Enable CORS!

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseAbpRequestLocalization();


            app.UseSignalR(routes =>
            {
                routes.MapHub <AbpCommonHub>("/signalr");
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "defaultWithArea",
                    template: "{area}/{controller=Home}/{action=Index}/{id?}");

                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            // Enable middleware to serve generated Swagger as a JSON endpoint
            app.UseSwagger();
            // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
            app.UseSwaggerUI(options =>
            {
                options.SwaggerEndpoint(_appConfiguration["App:ServerRootAddress"] + "/swagger/v1/swagger.json", "XTOPMS API V1");
                options.IndexStream = () => Assembly.GetExecutingAssembly()
                                      .GetManifestResourceStream("XTOPMS.Web.Host.wwwroot.swagger.ui.index.html");
            }); // URL: /swagger


            // HangFire
            // 20190419 - Eric.
            // HangFire分布式后端作业调度框架服务 https://yq.aliyun.com/articles/229859
            app.UseHangfireServer(
                new BackgroundJobServerOptions {
                WorkerCount             = 1,
                SchedulePollingInterval = TimeSpan.FromMinutes(1)
            }
                );

            app.UseHangfireDashboard("/hangfire");

            /*
             */
            app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                Authorization = new[]
                {
                    // new AbpHangfireAuthorizationFilter("MyHangFireDashboardPermissionName")
                    new AbpHangfireAuthorizationFilter("HangFire.Dashboard")
                },
                AppPath = "http://xto.biztalkgroup.com",
                // StatsPollingInterval = 60000
                DisplayStorageConnectionString = true
            });

            // Demo for background job
            // BackgroundJob.Enqueue(() => Console.WriteLine("Handfire regisited and running."));
            // BackgroundJob.Schedule(() => Console.WriteLine("Handfire running"), TimeSpan.FromSeconds(20));
            // RecurringJob.AddOrUpdate(() => Console.WriteLine("Recurrent running"), Cron.Minutely);

            // Loop query
            // RecurringJob.AddOrUpdate<DataSyncServiceProcess>("Data Sync Service Schedule Job)", (t) => t.Execute(null), Cron.Hourly);

            // Every 1 hour
            RecurringJob.AddOrUpdate <AccessTokenRefreshProcess>("Alibaba Access-Token Refresh Service", (t) => t.Execute(null), Cron.HourInterval(1));

            // Every day
            RecurringJob.AddOrUpdate <RefreshTokenRefreshProcess>("Alibaba Refresh-Token Refresh Service", (t) => t.Execute(null), Cron.Daily);

            //  Cron Expression
            // https://www.cnblogs.com/pipi-changing/p/5697481.html
            // http://cron.qqe2.com/
            // RecurringJob.AddOrUpdate<AlibabaCallbackMessageProcess>("Alibaba Callback Message Process Service", (t) => t.Execute(null), Cron.Hourly);
            // "0 0/15 * * * ? -- not work
            RecurringJob.AddOrUpdate <AlibabaCallbackMessageProcess>("Alibaba Callback Message Process Service", (t) => t.Execute(null), Cron.MinuteInterval(15));
        }