Scheduling multiple jobs

So this is all nice and good, but what if we want or need to schedule multiple jobs at the same time? In our real world, that possibility is very high. Here's an example of doing just that:

HostFactory.Run(c =>
{
c.Service<ContainerService>(s =>
{
s.ConstructUsing(name => new ContainerService());
s.WhenStarted((service, control) => service.Start());
s.WhenStopped((service, control) => service.Stop());
s.ScheduleQuartzJob<ContainerService>(q =>
q.WithJob(() =>
JobBuilder.Create<JobA>().Build())
.AddTrigger(() =>
TriggerBuilder.Create()
.WithSimpleSchedule(builder => builder
.WithIntervalInSeconds(10)
.RepeatForever())
.Build())
);
s.ScheduleQuartzJob<ContainerService>(q =>
q.WithJob(() =>
JobBuilder.Create<JobB>().Build())
.AddTrigger(() =>
TriggerBuilder.Create()
.WithSimpleSchedule(builder => builder
.WithIntervalInSeconds(60)
.RepeatForever())
.Build())
);
});
});
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset