Beispiel #1
0
        public ScheduleBuilder()
        {
            var ssf = new StdSchedulerFactory();

            Scheduler = ssf.GetScheduler();
            Scheduler.Start();
        }
 public Scheduler(IUnityContainer container)
 {
   this.container = container;
   ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
   quartzScheduler = schedulerFactory.GetScheduler();
   quartzScheduler.Start();
 }
Beispiel #3
0
        void Application_Start(object sender, EventArgs e)
        {
            //---------------------------初始化quartz---------------------------
            Quartz.ISchedulerFactory sf = new Quartz.Impl.StdSchedulerFactory();
            sched = sf.GetScheduler();
            sched.Start();
            //------------------------------------------------------------------

            Logger.Info("web启动成功");
        }
Beispiel #4
0
        protected override void OnStart(string[] args)
        {
            try
            {
                factory = new Quartz.Impl.StdSchedulerFactory();

                scheduler = factory.GetScheduler();

                scheduler.Start();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
        }
Beispiel #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                factory = new Quartz.Impl.StdSchedulerFactory();

                scheduler = factory.GetScheduler();

                scheduler.Start();
            }
            catch (Exception ex)
            {
                String s = ex.Message;
            }
        }
Beispiel #6
0
        //private ILog logger = LogManager.GetLogger(typeof(MvcApplication));

        protected void Application_Start()
        {
            //log4net.Config.XmlConfigurator.Configure();
            AreaRegistration.RegisterAllAreas();
            //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            JobSchedule         JobSchedule  = new JobSchedule();
            List <ScheduleTask> ScheduleTask = JobSchedule.ScheduleTaskInit();

            foreach (var ScheduleTaskItem in ScheduleTask)
            {
                if (ScheduleTaskItem.Status == "Enabled")
                {
                    scheduler.ScheduleJob(ScheduleTaskItem.Job, ScheduleTaskItem.Trigger);
                }
            }
            scheduler.Start();
        }
 protected override void OnStart(string[] args)
 {
     //System.Threading.Thread.Sleep(10000);
     scheduler.Start();
 }
Beispiel #8
0
        public void StartScheduler()
        {
            Quartz.Impl.StdSchedulerFactory factory = new Quartz.Impl.StdSchedulerFactory();
            Quartz.IScheduler scheduler             = factory.GetScheduler();

            string myJobName   = "MyFirstJob";
            string myGroupName = "MyGroup";

            string[] jobNames = scheduler.GetJobNames(myGroupName);

            if (!jobNames.Contains(myJobName))
            {
                Quartz.JobDetail job = new Quartz.JobDetail(myJobName, myGroupName, typeof(ConsoleJob1));
                job.JobDataMap.Add("ExtraText", "Plinko");
                Quartz.Trigger trigger = Quartz.TriggerUtils.MakeMinutelyTrigger(2);
                trigger.Name  = "myFirstTrigger";
                trigger.Group = myGroupName;

                scheduler.ScheduleJob(job, trigger);
            }

            if (!jobNames.Contains("HelloWorld1"))
            {
                Quartz.JobDetail job     = new Quartz.JobDetail("HelloWorld1", myGroupName, typeof(Quartz.Job.NoOpJob));
                Quartz.Trigger   trigger = Quartz.TriggerUtils.MakeMinutelyTrigger(15);
                trigger.Name  = "HelloWorld1Trigger";
                trigger.Group = myGroupName;

                scheduler.ScheduleJob(job, trigger);
            }

            if (!jobNames.Contains("HelloWorld2"))
            {
                Quartz.Impl.Calendar.HolidayCalendar calendar = new Quartz.Impl.Calendar.HolidayCalendar();
                calendar.AddExcludedDate(DateTime.Now.ToUniversalTime());
                calendar.AddExcludedDate(DateTime.Now.AddDays(4).ToUniversalTime());
                scheduler.AddCalendar("randomHolidays", calendar, true, true);

                Quartz.JobDetail job = new Quartz.JobDetail("HelloWorld2", myGroupName, typeof(Quartz.Job.NoOpJob));


                Quartz.Trigger trigger = Quartz.TriggerUtils.MakeDailyTrigger(15, 00);
                trigger.Name         = "HelloWorld2Trigger";
                trigger.Group        = myGroupName;
                trigger.CalendarName = "randomHolidays";


                scheduler.ScheduleJob(job, trigger);
            }

            if (!jobNames.Contains("TimeTrackerReminder"))
            {
                Quartz.JobDetail job     = new Quartz.JobDetail("TimeTrackerReminder", myGroupName, typeof(Quartz.Job.NoOpJob));
                Quartz.Trigger   trigger = Quartz.TriggerUtils.MakeWeeklyTrigger(DayOfWeek.Monday, 8, 0);
                trigger.Name  = "EveryMondayAtEight";
                trigger.Group = myGroupName;

                scheduler.ScheduleJob(job, trigger);
            }

            if (!jobNames.Contains("UnscheduledJob"))
            {
                Quartz.JobDetail job = new Quartz.JobDetail("UnscheduledJob", myGroupName, typeof(Quartz.Job.NoOpJob));
                scheduler.AddJob(job, true);
            }

            if (!jobNames.Contains("TwoAliens"))
            {
                Quartz.JobDetail job     = new Quartz.JobDetail("TwoAliens", myGroupName, typeof(TwoAlienJob));
                Quartz.Trigger   trigger = Quartz.TriggerUtils.MakeMonthlyTrigger(28, 23, 59);
                trigger.Name  = "EveryFullMoon";
                trigger.Group = myGroupName;

                scheduler.ScheduleJob(job, trigger);
            }


            scheduler.Start();
        }
 public Scheduler()
 {
   ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
   quartzScheduler = schedulerFactory.GetScheduler();
   quartzScheduler.Start();
 }
Beispiel #10
0
 public bool Start(HostControl hostControl)
 {
     scheduler.Start();
     return(true);
 }
Beispiel #11
0
 protected override void OnStart(string[] args)
 {
     scheduler.Start();
 }