Beispiel #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseHangfireDashboard("");
            app.UseHangfireServer();

            RecurringJob.AddOrUpdate(() => SuperpagosApiHealth(), Cron.MinuteInterval(1));
            RecurringJob.AddOrUpdate(() => SengGridApiHealth(), Cron.MinuteInterval(1));

            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseMvc(routes => {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Beispiel #2
0
        public static bool Start()
        {
            try
            {
                var p1 = new NotificationsProcess();
                RecurringJob.AddOrUpdate("NotificationsProcess", () => p1.RunAsync(), Cron.Minutely);

                var p2 = new RedialProcess();
                RecurringJob.AddOrUpdate("RedialProcess", () => p2.RunAsync(), Cron.MinuteInterval(10));
                return(true);
            }
            catch (AggregateException aex)
            {
                aex.Data.Add("Method", "Start");
                aex.Data.Add("ExType", "AggregateException");
                LoggerSingleton.Instance.Error("HangfireManager", aex);

                Debug.WriteLine($"[ERROR] HangfireManager.Start. ex: {aex.Message}");
                return(false);
            }
            catch (Exception ex)
            {
                ex.Data.Add("Method", "Start");
                ex.Data.Add("ExType", "AggregateException");
                LoggerSingleton.Instance.Error("HangfireManager", ex);

                Debug.WriteLine($"[ERROR] HangfireManager.Start. ex: {ex.Message}");
                return(false);
            }
        }
Beispiel #3
0
 public HomeController(ILogger <HomeController> logger, Updater u)
 {
     //   Updater u = .GetRequiredService<DbCryptoContext>();
     this.Logger = logger;
     RecurringJob.AddOrUpdate(() => u.Execute(), Cron.MinuteInterval(10));
     u.Execute();
 }
        public IActionResult Run(int id)
        {
            var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            var role   = User.FindFirst(ClaimTypes.Role)?.Value;

            var application = _unitOfWork.Repository <Application>().FindById(id);

            if (application == null)
            {
                return(BadRequest());
            }

            if (role != "Administrator" && application.UserId != userId)
            {
                return(BadRequest());
            }

            if (!application.IsRun && application.RequestIntervalAtMinute > 0)
            {
                var jobId = Guid.NewGuid().ToString();
                RecurringJob.AddOrUpdate(jobId, () => RequestToApp(application), Cron.MinuteInterval(application.RequestIntervalAtMinute));
                application.IsRun = true;
                application.JobId = jobId;
                _unitOfWork.Save();
            }

            return(Ok());
        }
Beispiel #5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            byte[] gbyte     = Encoding.GetEncoding("GB2312").GetBytes("这是GB2312编码!");
            string base64Str = Convert.ToBase64String(gbyte);



            string[] Demos = { "1", "A", "w", "6" };
            //var strDic = from obDic in Demos orderby StringComparer.Ordinal descending select obDic;
            Array.Sort(Demos, string.CompareOrdinal);
            string[] result3 = Demos;
            //string[] result2 = strDic.ToArray();
            string aa = "1321313";

            return;



            int mathNum = 1996;
            int result  = (int)AssemblyHelper.DLLFuncWithParam(out string expInfo, @"I:\API开发(Romens雨人)\LearnWay\HongFireSimple\Demo\bin\Debug\Demo.dll", "Demo", "Math", "Add", new Type[] { Type.GetType("System.Int32") }, mathNum);
            int result1 = (int)AssemblyHelper.DLLFunc(out string error, @"I:\API开发(Romens雨人)\LearnWay\HongFireSimple\Demo\bin\Debug\Demo.dll", "Demo", "Math", "Reduce");

            AssemblyHelper.DLLAction(out string e2, @"I:\API开发(Romens雨人)\LearnWay\HongFireSimple\Demo\bin\Debug\Demo.dll", "Demo", "Math", "Errormethod");
            int[] ints;

            TaskLog taskLog = new TaskLog();
            Task    t       = new Task(() => {
                taskLog.DebugLog();
            });

            //重复任务
            RecurringJob.AddOrUpdate("20190323LoopTask", () => taskLog.DebugLog(), Cron.MinuteInterval(5));
        }
Beispiel #6
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IHostingEnvironment env)
 {
     if (env.IsDevelopment())
     {
         app.UseDeveloperExceptionPage();
         app.UseDatabaseErrorPage();
     }
     else
     {
         app.UseExceptionHandler("/Home/Error");
         // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
         app.UseHsts();
     }
     app.UseHttpsRedirection();
     app.UseStaticFiles();
     app.UseCookiePolicy();
     app.UseHangfireServer();
     app.UseHangfireDashboard();
     app.UseAuthentication();
     app.UseSession();
     app.UseMvc(routes =>
     {
         routes.MapRoute(
             name: "default",
             template: "{controller=Home}/{action=Index}/{id?}");
     });
     RecurringJob.AddOrUpdate <Scheduler>(x => x.ProcessUserAlbumScheduler(), Cron.MinuteInterval(10));
 }
Beispiel #7
0
        public void Configuration(IAppBuilder app)
        {
            //app.MapSignalR();


            //Must Manual Create Database In SQL Server
            //GlobalConfiguration.Configuration.UseSqlServerStorage("HangFireDB");
            GlobalConfiguration.Configuration.UseMongoStorage("mongodb://localhost:27017", "rdiofeedlyhangfire");

            app.UseHangfireServer();
            app.UseHangfireDashboard();
            ConfigureAuth(app);

            var rssService = new Service.RssService();

            RecurringJob.AddOrUpdate(() => rssService.RssFetcherManager(), Cron.MinuteInterval(5));

            var crawlService = new Service.CrawlerService();

            RecurringJob.AddOrUpdate(() => crawlService.CrawlManager(), Cron.MinuteInterval(5));

            var crawlLinkService = new Service.CrawlerService();

            RecurringJob.AddOrUpdate(() => crawlLinkService.CrawlLinkManager(), Cron.MinuteInterval(5));
        }
Beispiel #8
0
        // 如需設定驗證的詳細資訊,請瀏覽 http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // 配置Middleware 組件
            log.Info("StartupConfigureAuth");
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath          = new PathString("/Index/Login"),
                CookieSecure       = CookieSecureOption.Never,
            });
            //加入HangFire 排程作業
            var context = new topmepEntities();

            //使用ms sql 紀錄任務
            GlobalConfiguration.Configuration.UseSqlServerStorage(context.Database.Connection.ConnectionString,
                                                                  new SqlServerStorageOptions
            {
                // if it is set to 1 minutes, each worker will run a keep-alive query each minute when processing a job
                QueuePollInterval = TimeSpan.FromMinutes(1)
            }

                                                                  );
            // 啟用HanfireServer
            app.UseHangfireServer(new BackgroundJobServerOptions {
                WorkerCount = 1
            });
            RecurringJob.AddOrUpdate <BackgroundService>("BackgroundService", x => x.SendMailSchedule(),
                                                         Cron.MinuteInterval(1),
                                                         TimeZoneInfo.FindSystemTimeZoneById("Taipei Standard Time"));
            // 啟用Hangfire的Dashboard
            app.UseHangfireDashboard();
        }
Beispiel #9
0
        public static void ConfigureHangfire(this ServiceProvider serviceProvider, IConfiguration configuration)
        {
            var scopeFactory = (IServiceScopeFactory)serviceProvider.GetService(typeof(IServiceScopeFactory));

            GlobalConfiguration.Configuration.UseLogProvider(new HangfireLoggerProvider());
            GlobalConfiguration.Configuration.UseActivator(new AspNetCoreJobActivator(scopeFactory));

            // Hangfire
            // UseMemoryStorage
            if (bool.Parse(configuration["AppSettings:UseMemoryStorage"]))
            {
                GlobalConfiguration.Configuration.UseMemoryStorage();
            }
            else
            {
                GlobalConfiguration.Configuration.UseSqlServerStorage(configuration.GetConnectionString("CryptoWatcher"));
            }

            // Background jobs
            var jobsIntervalInMinutes = int.Parse(configuration["AppSettings:JobsIntervalInMinutes"]);

            var mainJob = serviceProvider.GetService <MainJob>();
            var sendWhatsappNotificationsJob = serviceProvider.GetService <SendWhatsappNotificationsJob>();
            var sendTelegramNotificationsJob = serviceProvider.GetService <SendWhatsappNotificationsJob>();
            var removeLinesJob = serviceProvider.GetService <RemoveLinesJob>();

            RecurringJob.AddOrUpdate("Main", () => mainJob.Run(), Cron.MinuteInterval(jobsIntervalInMinutes));
            RecurringJob.AddOrUpdate("Send whatsapp notifications", () => sendWhatsappNotificationsJob.Run(), Cron.MinuteInterval(jobsIntervalInMinutes));
            RecurringJob.AddOrUpdate("Send telegram notifications", () => sendTelegramNotificationsJob.Run(), Cron.MinuteInterval(jobsIntervalInMinutes));
            RecurringJob.AddOrUpdate("Remove lines", () => removeLinesJob.Run(), Cron.MinuteInterval(jobsIntervalInMinutes));
        }
Beispiel #10
0
        public static void Launch()
        {
            const string connectionString  = "Data Source=DESKTOP-T4INEAM\\SQLEXPRESS;Initial Catalog=NewsAggregator;Integrated Security=True";
            var          serviceCollection = new ServiceCollection();

            RegisterNewsAggregatorML(serviceCollection, connectionString);
            RegisterLogging(serviceCollection);
            RegisterMassTransit(serviceCollection);
            var serviceProvider = serviceCollection.BuildServiceProvider();

            Seed(serviceProvider);
            StartBus(serviceProvider);
            GlobalConfiguration.Configuration
            .UseSqlServerStorage(connectionString)
            .UseActivator(new HangfireActivator(serviceProvider));
            using (var server = new BackgroundJobServer(new BackgroundJobServerOptions
            {
                WorkerCount = 1
            }))
            {
                var interval = Cron.MinuteInterval(5);
                RecurringJob.AddOrUpdate <IArticleExtractorJob>("rssExtractArticles", j => j.Run(CancellationToken.None), Cron.MinuteInterval(5));
                // RecurringJob.AddOrUpdate<INextArticleRecommenderJob>("nextArticlesRecommender", j => j.Run(CancellationToken.None), Cron.HourInterval(1));
                Console.WriteLine("Press Enter to quit the application !");
                Console.ReadLine();
            }
        }
Beispiel #11
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              IJobFactory jobFactory)
        {
            int hangfireIntervalInMinutes = Configuration.GetSection("Hangfire").GetValue <int>("IntervalInMinutes");

            var cronString = Cron.MinuteInterval(hangfireIntervalInMinutes);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseAuthentication();
            app.UseHangfireDashboard();

            RecurringJob.AddOrUpdate(() => jobFactory.CreateNew("UpdateMoviesJob").DoJob(), cronString);

            app.UseSwagger();
            app.UseSwaggerUI(o =>
            {
                o.SwaggerEndpoint("../swagger/v1/swagger.json", "MovieSearch.UI.WebApi v1");
            });

            app.UseMvc();
        }
Beispiel #12
0
        protected override void OnModuleStarting()
        {
            _thisModule = this;

            var taskSchedulingManager = AppCore.Get <TaskSchedulingManager>();
            var task = taskSchedulingManager.RegisterTask(new TaskRequest()
            {
                Name            = "Проверка новых необработанных слов",
                Description     = "",
                IsEnabled       = true,
                TaskOptions     = TaskOptions.AllowDisabling | TaskOptions.AllowManualSchedule | TaskOptions.PreventParallelExecution,
                UniqueKey       = $"{typeof(LexiconManager).FullName}_{nameof(LexiconManager.PrepareNewWords)}",
                ExecutionLambda = () => LexiconNewWordsStatic()
            });

            if (task.ManualSchedules.Count == 0)
            {
                taskSchedulingManager.SetTaskManualScheduleList(task, new List <TaskSchedule>()
                {
                    new TaskCronSchedule(Cron.MinuteInterval(2))
                    {
                        IsEnabled = true
                    }
                });
            }
        }
Beispiel #13
0
        internal static void ScheduleJobs()
        {
            ServiceScheduler objServiceScheduler = new ServiceScheduler();

            // 1. Fire and Forget job: When code need to run in the background immediately.
            // Run only Once
            var fireAndForgetJobId = BackgroundJob.Enqueue(
                () => objServiceScheduler.bulkFileProcess.ProcessFiles("1. Fire and Forget job")
                );

            // 2. Delayed job: When code need to run in the background after some delay. Postponed background jobs.
            // Run only Once
            var delayedJobId = BackgroundJob.Schedule(
                () => objServiceScheduler.bulkFileProcess.ProcessFiles("2. Scheduled background jobs with delay"),
                TimeSpan.FromMinutes(2)
                );

            // 3. Recurring job: When code need to run recucively with time frequency.
            // Run Repeatly
            // Cron Expression can be passed for better frequency management.
            RecurringJob.AddOrUpdate(
                () => objServiceScheduler.bulkFileProcess.ProcessFiles("3. Recursive job called with 2 minutes interval"),
                Cron.MinuteInterval(1)
                );
        }
Beispiel #14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();


            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseHangfireServer();
            RecurringJob.AddOrUpdate(() => RecordActualWeather.GetActualWeather(), Cron.MinuteInterval(1));
            RecurringJob.AddOrUpdate(() => DayUpdate.Update(), Cron.HourInterval(1));
            app.UseHangfireDashboard();
            app.UseStaticFiles();

            app.UseIdentity();

            // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Beispiel #15
0
        public async Task <IActionResult> OnPostScheduleJobAsync()
        {
            string started = DateTime.Now.ToString();

            RecurringJob.AddOrUpdate(() => MailAsync("Recurring", started), Cron.MinuteInterval(3));
            return(Page());
        }
Beispiel #16
0
        // POST: api/Monitor
        public void Post(GuardadoMonitorDTO monitorDTO)
        {
            if (ModelState.IsValid)
            {
                var entidad = Mapper.Map <Model.Monitor>(monitorDTO);

                using (Model.Context db = new Model.Context())
                {
                    var monitor = db.Monitors.Where(m => m.Id == entidad.Id).FirstOrDefault();

                    if (monitor == null)
                    {
                        db.Monitors.Add(entidad);
                    }
                    else
                    {
                        Mapper.Map(entidad, monitor, entidad.GetType(), monitor.GetType());
                    }

                    db.SaveChanges();
                }

                RecurringJob.
                AddOrUpdate("tarea_" + entidad.Id.ToString(),
                            () => FuncionFactory.EjecutarTarea(entidad.Id),
                            Cron.MinuteInterval(entidad.Intervalo));
            }
        }
        public override void Configuration(IAppBuilder app)
        {
            base.Configuration(app);

            // Hangfire isn't supported by SQL CE, so the rest of the code is disabled for now
            return;

            // Configure Hangfire (step 1)
            GlobalConfiguration.Configuration
            .UseSqlServerStorage(Umbraco.Core.ApplicationContext.Current.DatabaseContext.ConnectionString)
            .UseConsole();

            // Make sure we only allow backoffice users access to the Hangfire dashboard
            DashboardOptions dashboardOptions = new DashboardOptions {
                Authorization = new[] {
                    new UmbracoAuthorizationFilter()
                }
            };

            // Configure Hangfire (step 2)
            app.UseHangfireDashboard("/hangfire", dashboardOptions);
            app.UseHangfireServer();

            // Add a new job for import products
            RecurringJob.AddOrUpdate(() => new HangfireJobs().ImportProducts(null), Cron.MinuteInterval(15));
        }
        public static IApplicationBuilder UseRostamBotLibraries(this IApplicationBuilder app, IConfiguration configuration, string _apiVersion)
        {
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint($"/swagger/v{_apiVersion}/swagger.json", $"RostamBot API v{_apiVersion}");
                c.DocumentTitle = "RostamBot API";
                c.DocExpansion(DocExpansion.List);
            });


            var hangfireDashboardOptions = new DashboardOptions
            {
                Authorization  = new[] { new HangfireDashboardAuthorizationFilter(configuration) },
                IsReadOnlyFunc = (DashboardContext context) => true,
                DisplayStorageConnectionString = false,
                StatsPollingInterval           = 30000
            };

            app.UseHangfireDashboard(configuration["RostamBotSettings:JobDashboardUrl"], hangfireDashboardOptions);

            //ToDo: remove magic numbers
            GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute {
                Attempts = 2, DelaysInSeconds = new int[] { 1200, 1200 }
            });
            app.UseHangfireServer();

            RecurringJob.AddOrUpdate <ISyncReportsJob>(job => job.GetMentionsAsync(), Cron.MinuteInterval(20));
            RecurringJob.AddOrUpdate <ISyncReportsJob>(job => job.GetDirectsAsync(), Cron.MinuteInterval(20));


            return(app);
        }
Beispiel #19
0
        public static string GetCronIntervalByMinutes(int interval)
        {
            var result = string.Empty;

            switch (interval)
            {
            case 10:
                result = Cron.MinuteInterval(10);
                break;

            case 60:
                result = Cron.HourInterval(GetFullHoursByMinutes(60));
                break;

            case 180:
                result = Cron.HourInterval(GetFullHoursByMinutes(180));
                break;

            case 720:
                result = Cron.HourInterval(GetFullHoursByMinutes(720));
                break;

            case 1440:
                result = Cron.DayInterval(GetFullDaysByMinutes(1440));
                break;
            }
            return(result);
        }
Beispiel #20
0
        public string GetCron()
        {
            switch (UploadIntervalOption)
            {
            case UploadIntervalOption.Instantly:
                return(Cron.Minutely());

            case UploadIntervalOption.InMinutes:
                return(Cron.MinuteInterval(IntervalValue));

            case UploadIntervalOption.InHours:
                return(Cron.HourInterval(IntervalValue));

            case UploadIntervalOption.InDays:
                if (!OnExactDayTime.HasValue)
                {
                    throw new ArgumentOutOfRangeException();
                }
                int minute = OnExactDayTime.Value.Minute;
                int hour   = OnExactDayTime.Value.Hour;
                return($"{minute} {hour} */{IntervalValue} * *");

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public static void UpdateRecurringEvent(WebCheck check)
        {
            // update existing event
            string checkID = check.WebCheckID.ToString();

            RecurringJob.AddOrUpdate(checkID, () => CheckDomainForHttps(check), Cron.MinuteInterval(check.Delay));
        }
        public gitRepo_Controller(IHttpClientFactory clientFactory, gitRepo_Context context)
        {
            _clientFactory = clientFactory;
            _Context       = context;

            RecurringJob.AddOrUpdate(() => this.pullRepos(), Cron.MinuteInterval(10));
        }
        public void Start()
        {
            BootstrapHangfire();
            RecurringJob.AddOrUpdate(() => PublishMessage(), Cron.MinuteInterval(10));

            backgroundJobServer = new BackgroundJobServer();
        }
Beispiel #24
0
        /// <inheritdoc />
        public void Run()
        {
            var minute = 5;

            int.TryParse(ConfigurationManager.AppSettings["Game:HeroStayInCastleTime"], out minute);
            RecurringJob.AddOrUpdate <IGameService>(g => g.UpdateNearbyHero(), Cron.MinuteInterval(minute));
        }
        public static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");
            var config = builder.Build();


            var dbBuilder = new DbContextOptionsBuilder <TextContext>();

            dbBuilder.UseSqlite("Data Source=" + config["ConnectionStrings:SQLiteTextDb"]);
            dbName = config["ConnectionStrings:SQLiteTextDb"];
            var textContext = new TextContext(dbBuilder.Options);

            JobStorage.Current = new SQLiteStorage(config["ConnectionStrings:SQLiteHangfire"]);

            // Create DB with test data.
            CreateDbWithTestData(textContext);

            // Split Texts after seeding.
            //BackgroundTasks.SplitNewTexts(textContext);

            // Create Background Task for new texts.
            Task.Factory.StartNew(() =>
            {
                Log.SeqLog.WriteNewLogMessage("Createing background job Split new texts.");
                //BackgroundJob.Enqueue(
                //        () => BackgroundTasks.SplitNewTexts(config["ConnectionStrings:SQLiteTextDb"]));
                RecurringJob.AddOrUpdate(
                    () => BackgroundTasks.SplitNewTexts(config["ConnectionStrings:SQLiteTextDb"]),
                    Cron.MinuteInterval(5));
            });

            BuildWebHost(args).Run();
        }
Beispiel #26
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceProvider provider)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

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

            app.UseHangfireServer();
            app.UseHangfireDashboard("/hangfire");

            //BackgroundJob.Schedule(() => OnTimer(), TimeSpan.FromMinutes(1));
            RecurringJob.AddOrUpdate("torrentRss", () => OnTimer(), Cron.MinuteInterval(1));

            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World!");
            //});
        }
Beispiel #27
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IBackgroundJobClient backgroundJobs, IHostingEnvironment env, FlightManager flightManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseStaticFiles();

            app.UseHangfireDashboard();
            RecurringJob.AddOrUpdate(
                () => flightManager.ProcessFlightsAsync(),
                Cron.MinuteInterval(2));

            app.UseAuthentication(); //autentikációs middleware

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

            //SetupAuth(app.ApplicationServices).Wait();
        }
Beispiel #28
0
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddJobServer(options => {
         options.Register <SimpleJob>(Cron.EveryMinute());
         options.Register <WorkOnSpecificTimeJob>(Cron.MinuteInterval(4));
     });
     services.AddMvc();
 }
        public IActionResult recurringJob()
        {
            var interval = 1;

            RecurringJob.AddOrUpdate("Generated Report", () => GeneratedReport(), Cron.MinuteInterval(interval));
            //var jobID = BackgroundJob.Schedule(() => sendEmail("Welcome to our apps"), TimeSpan.FromSeconds(interval));
            return(Ok("Generated report initated."));
        }
Beispiel #30
0
        public static IEnumerable <object[]> GetPluginFilePathTestData()
        {
            yield return(new object [] { "emoji.20s.sh", "emoji", "20s", Cron.SecondInterval(20) });

            yield return(new object [] { "awesome.2m.sh", "awesome", "2m", Cron.MinuteInterval(2) });

            yield return(new object [] { "noextension.10h", "noextension", "10h", Cron.HourInterval(10) });
        }