示例#1
0
        /// <summary>
        /// SimpleQuartz
        /// </summary>
        /// <param name="packageDownloaderJobInAppSettings">appSettings in appSettings config</param>
        private static void SimpleQuartz(string appSettingsKey, IJobDetail job)
        {
            int seconds = TimeSpanHelper.GetSecond(ConfigurationManager.AppSettings[appSettingsKey]);
            // Trigger the job to run on the next round minute

            ITrigger trigger = TriggerBuilder.Create()
                               .WithIdentity("trigger1" + job.Key, "group1")
                               .WithSimpleSchedule(x => x.WithIntervalInSeconds(seconds).RepeatForever())
                               .StartNow()
                               .Build();

            // Tell quartz to schedule the job using our trigger
            scheduler.ScheduleJob(job, trigger);
        }