当前位置: 首页>>代码示例>>C#>>正文


C# IScheduler.Start方法代码示例

本文整理汇总了C#中IScheduler.Start方法的典型用法代码示例。如果您正苦于以下问题:C# IScheduler.Start方法的具体用法?C# IScheduler.Start怎么用?C# IScheduler.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IScheduler的用法示例。


在下文中一共展示了IScheduler.Start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

        public override void Start()
        {
            base.Start();

            var isolatedJob = Defaults.IsIsolatedJob;

            var schedulerFactory = IocManager.Resolve<ISchedulerFactory>();
            scheduler = schedulerFactory.GetScheduler();
            if (isolatedJob)
            {
                scheduler.JobFactory = new IsolatedJobFactory();
            }

            scheduler.Start();

            IocManager.Register<IScheduler>(scheduler);

            var jobListeners = IocManager.Resolve<IEnumerable<IJobListener>>();
            foreach (var jobListener in jobListeners)
            {
                scheduler.ListenerManager.AddJobListener(jobListener);
            }

            var triggerListeners = IocManager.Resolve<IEnumerable<ITriggerListener>>();
            foreach (var triggerListener in triggerListeners)
            {
                scheduler.ListenerManager.AddTriggerListener(triggerListener);
            }
        }
开发者ID:yonglehou,项目名称:ImcTF,代码行数:29,代码来源:StdQuartzModule.cs

示例2: Main

        static void Main(string[] args)
        {
            try
            {
                Console.Title = "QMail";
                Console.ForegroundColor = ConsoleColor.White;
                ISchedulerFactory sf = new StdSchedulerFactory();
                Scheduler = sf.GetScheduler();
                new TskInspectDetailJobTrigger();
                Scheduler.Start();

                for (var i = 0; i < 10; i++) {
                    Console.WriteLine();
                }

                Console.ForegroundColor = ConsoleColor.Yellow;

                Console.WriteLine("       ---------------------------------------------------");
                Console.WriteLine("       ...................QMail已启动......................");
                Console.WriteLine("       ...................请不要关闭此窗口.................");
                Console.WriteLine("       ---------------------------------------------------");
                for (var i = 0; i < 10; i++)
                {
                    Console.WriteLine();
                }
                Console.ReadLine();
            }
            catch (Exception e) {
                LogUtil.Logger.Error(e.Message);
            }
        }
开发者ID:shentianyi,项目名称:ifDataHouse,代码行数:31,代码来源:QmailRunner.cs

示例3: StartScheduler

        private void StartScheduler()
        {
            ISchedulerFactory schedFact = new StdSchedulerFactory();

                Scheduler = schedFact.GetScheduler();
                Scheduler.Start();
        }
开发者ID:Letractively,项目名称:dc-gamification,代码行数:7,代码来源:Form1.cs

示例4: Promoted

 public void Promoted(IServiceBus bus)
 {
     if (_scheduler != null && !_scheduler.IsShutdown) _scheduler.Shutdown();
     _scheduler = _schedulerFactory();
     _scheduler.JobFactory = new ServiceBusJobFactory(bus);
     _scheduler.Start();
 }
开发者ID:fivepmtechnology,项目名称:MassTransit-Cluster,代码行数:7,代码来源:SchedulerService.cs

示例5: OnStart

        protected override void OnStart(string[] args)
        {
            Logger = LogManager.GetCurrentClassLogger();
            Logger.Info("Service Starting");

            ExporterTriggerList = new List<ITrigger>();
            ExporterDetailList = new List<IJobDetail>();

            if(Settings.Default.InvokeDebugger)
            {
                Logger.Info("Starting Debugger");
                Debugger.Launch();
            }

            try
            {
                Logger.Info("Starting Scheduler");
                Scheduler = StdSchedulerFactory.GetDefaultScheduler();
                Scheduler.Start();

                ConfigBaseDir = "C:\\SFTPExporter\\Configs\\";
                if(!System.IO.Directory.Exists(ConfigBaseDir))
                {
                    System.IO.Directory.CreateDirectory(ConfigBaseDir);
                }
            }
            catch(Exception ex)
            {
               Logger.Fatal("Failed to start service", ex);
               this.Stop();
            }
        }
开发者ID:mrchrisosburn,项目名称:Answer1SFTP,代码行数:32,代码来源:SFTPExporterService.cs

示例6: Start

        public void Start()
        {
            _log.Info("统计服务正在启动");

            scheduler = StdSchedulerFactory.GetDefaultScheduler();
            scheduler.Start();
        }
开发者ID:lcomplete,项目名称:Iridescent,代码行数:7,代码来源:QuartzService.cs

示例7: Scheduler

 static Scheduler()
 {
     ISchedulerFactory schedFact = new StdSchedulerFactory();
     QuartzSheduler = schedFact.GetScheduler();
     QuartzSheduler.Start();
     items = new List<Item>();
 }
开发者ID:Aestek,项目名称:IrisMailer,代码行数:7,代码来源:Scheduler.cs

示例8: InitScheduler

        public static void InitScheduler(String link)
        {
            if (rootPath != null)
                return;
            rootPath = link;
            ISchedulerFactory schedFact = new StdSchedulerFactory();
            Scheduler = schedFact.GetScheduler();
            Scheduler.Start();
            IJobDetail jobDetail = JobBuilder.Create<PhotoNotifyJob>().WithIdentity("PhotoNotificationJob").Build();
            jobDetail.JobDataMap.Add("path", rootPath);
            //Wystartuj jak najwczesniej, o godzinie 2:00 rano
            DateTime startAt = DateTime.Today;

            startAt = startAt.AddHours(2);
            if (startAt < DateTime.Now) //jesli juz minela godzina 2, wystartuj nastepnego dnia
                startAt = startAt.AddDays(1);

            ITrigger trigger2 = (ISimpleTrigger)TriggerBuilder.Create()
                                           .WithIdentity("trigger")
                                           .StartAt(startAt) // wystartuj scheduler o zadanej godzinie
                                           .WithSimpleSchedule(x => x.WithIntervalInHours(24).RepeatForever()) //odpalaj notyfikacje co 24h, bez limitu powtorzen
                                           .Build();
            DateTimeOffset ft = Scheduler.ScheduleJob(jobDetail, trigger2);
            System.Diagnostics.Debug.WriteLine(jobDetail.Key + " has been scheduled to run at: " + ft);
        }
开发者ID:qbajas,项目名称:PhotoHistory,代码行数:25,代码来源:SchedulerManager.cs

示例9: OnStart

        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            bool result = base.OnStart();

            Bootstrap();
            scheduler = container.GetInstance<IScheduler>();


            // Below this line should be whatever code you are using today to schedule jobs, triggers, etc. and start the scheduler. This is just here for context

            // add jobs and start scheduler
            scheduler.ScheduleJob(
                JobBuilder.Create<JobNotification>().Build(),
                TriggerBuilder.Create().WithSimpleSchedule(
                    
                    s => s.WithIntervalInSeconds(60)).Build());

            // start scheduler
            scheduler.Start();


            Trace.TraceInformation("WorkerRoleTestDI_Entity has been started");

            return result;
        }
开发者ID:fjvela,项目名称:dotnet-ef-ioc-mvc-webapi-worker-nlayers,代码行数:31,代码来源:WorkerRole.cs

示例10: JobSchedule

        public JobSchedule()
        {
            var schedFact = new StdSchedulerFactory();

            sched = schedFact.GetScheduler();
            sched.Start();
        }
开发者ID:nexbit,项目名称:Brisebois.WindowsAzure,代码行数:7,代码来源:JobSchedule.cs

示例11: Setup_quartz_service

        public void Setup_quartz_service()
        {
            ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
            _scheduler = schedulerFactory.GetScheduler();

            _receivedA = new ManualResetEvent(false);
            _receivedIA = new ManualResetEvent(false);

            _bus = ServiceBusFactory.New(x =>
                {
                    x.ReceiveFrom("loopback://localhost/quartz");
                    x.UseXmlSerializer();
                    x.SetConcurrentConsumerLimit(1);

                    x.Subscribe(s =>
                        {
                            s.Handler<A>(msg => _receivedA.Set());
                            s.Handler<IA>(msg => _receivedIA.Set());
                            s.Consumer(() => new ScheduleMessageConsumer(_scheduler));
                            s.Consumer(() => new CancelScheduledMessageConsumer(_scheduler));
                        });
                });

            _scheduler.JobFactory = new MassTransitJobFactory(_bus);
            _scheduler.Start();
        }
开发者ID:ahives,项目名称:MassTransit-Quartz,代码行数:26,代码来源:Service_Specs.cs

示例12: TaskPool

 static TaskPool()
 {
     _taskpool = new TaskPool();
     ISchedulerFactory sf = new StdSchedulerFactory();
     _ische = sf.GetScheduler();
     _ische.Start();
 }
开发者ID:zwc00zwc,项目名称:TaskManager,代码行数:7,代码来源:TaskPool.cs

示例13: Main

        public static void Main(string[] args)
        {
            //            XmlConfigurator.Configure();

               var properties = new NameValueCollection();
               properties["quartz.scheduler.instanceName"] = "ServerScheduler";

            // set thread pool info
            properties["quartz.threadPool.threadCount"] = "0";

            // set remoting expoter
            properties["quartz.scheduler.proxy"] = "true";
            properties["quartz.scheduler.proxy.address"] = "tcp://localhost:555/QuartzScheduler";

            var scheduleFactory = new StdSchedulerFactory(properties);

            scheduler = scheduleFactory.GetScheduler();
            var md = scheduler.GetMetaData();
            scheduler.Start();

            IJobDetail job = JobBuilder.Create<Jobs.SimpleJob>().Build();

            ITrigger jobTrigger = new SimpleTriggerImpl("TenSecondTrigger", 20, new TimeSpan(0, 0, 0, 5));

            //Periodic scheduling
            scheduler.ScheduleJob(job,jobTrigger);

            //Trigger a job from elsewhere without a trigger for one time
            var jobKey = job.Key;
            var jobDataMap = job.JobDataMap;
            scheduler.TriggerJob(jobKey,jobDataMap);
        }
开发者ID:srutis90,项目名称:QuartzAsWindowsService,代码行数:32,代码来源:Program.cs

示例14: Initialize

 public void Initialize()
 {
     _logger.DebugFormat("Start to Initialize instance of Quartz server");
     _schedulerFactory = new StdSchedulerFactory();
     _scheduler = _schedulerFactory.GetScheduler();
     _scheduler.Start();
 }
开发者ID:redrhino,项目名称:autoMT4,代码行数:7,代码来源:QuartzServer.cs

示例15: Start

        public void Start()
        {
            sf = new StdSchedulerFactory();
            sched = sf.GetScheduler();
            sched.JobFactory = _jobFactory;

            IJobDetail job1 = JobBuilder.Create<Job1>()
                .WithIdentity("job1", "group1")
                .Build();
            IJobDetail job2 = JobBuilder.Create<Job2>()
                .WithIdentity("job2", "group1")
                .Build();
            IJobDetail job3 = JobBuilder.Create<Job3>()
                .WithIdentity("job3", "group1")
                .Build();

            var trigger1 = (ICronTrigger) TriggerBuilder.Create()
                                              .WithIdentity("trigger1", "group1").StartNow()
                                              .WithCronSchedule("0/2 * * * * ?")
                                              .Build();
            var trigger2 = (ICronTrigger) TriggerBuilder.Create()
                                              .WithIdentity("trigger2", "group1").StartNow()
                                              .WithCronSchedule("0/5 * * * * ?")
                                              .Build();
            var trigger3 = (ICronTrigger) TriggerBuilder.Create()
                                              .WithIdentity("trigger3", "group1").StartNow()
                                              .WithCronSchedule("0/10 * * * * ?")
                                              .Build();

            sched.ScheduleJob(job1, trigger1);
            sched.ScheduleJob(job2, trigger2);
            sched.ScheduleJob(job3, trigger3);

            sched.Start();
        }
开发者ID:onurogurtani,项目名称:QuartzCastleWindsor,代码行数:35,代码来源:QuartzInitializer.cs


注:本文中的IScheduler.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。