本文整理汇总了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);
}
}
示例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);
}
}
示例3: StartScheduler
private void StartScheduler()
{
ISchedulerFactory schedFact = new StdSchedulerFactory();
Scheduler = schedFact.GetScheduler();
Scheduler.Start();
}
示例4: Promoted
public void Promoted(IServiceBus bus)
{
if (_scheduler != null && !_scheduler.IsShutdown) _scheduler.Shutdown();
_scheduler = _schedulerFactory();
_scheduler.JobFactory = new ServiceBusJobFactory(bus);
_scheduler.Start();
}
示例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();
}
}
示例6: Start
public void Start()
{
_log.Info("统计服务正在启动");
scheduler = StdSchedulerFactory.GetDefaultScheduler();
scheduler.Start();
}
示例7: Scheduler
static Scheduler()
{
ISchedulerFactory schedFact = new StdSchedulerFactory();
QuartzSheduler = schedFact.GetScheduler();
QuartzSheduler.Start();
items = new List<Item>();
}
示例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);
}
示例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;
}
示例10: JobSchedule
public JobSchedule()
{
var schedFact = new StdSchedulerFactory();
sched = schedFact.GetScheduler();
sched.Start();
}
示例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();
}
示例12: TaskPool
static TaskPool()
{
_taskpool = new TaskPool();
ISchedulerFactory sf = new StdSchedulerFactory();
_ische = sf.GetScheduler();
_ische.Start();
}
示例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);
}
示例14: Initialize
public void Initialize()
{
_logger.DebugFormat("Start to Initialize instance of Quartz server");
_schedulerFactory = new StdSchedulerFactory();
_scheduler = _schedulerFactory.GetScheduler();
_scheduler.Start();
}
示例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();
}