|
6 | 6 |
|
7 | 7 | // IOC container setup |
8 | 8 |
|
9 | | -DIContainer.Current.RegisterAll() |
| 9 | +DIContainer.Current |
| 10 | + .RegisterAll() |
10 | 11 | .Verify(); |
11 | 12 |
|
12 | 13 | // Using scheduler |
13 | 14 |
|
14 | | -using (var scheduler = new MultitaskScheduler()) |
15 | | -{ |
16 | | - scheduler.OnJobStart += HandlerDiagnostics.HandlerOnJobStart; |
17 | | - scheduler.OnJobFinish += HandlerDiagnostics.HandlerOnJobFinish; |
| 15 | +using var scheduler = new MultitaskScheduler(); |
18 | 16 |
|
19 | | - scheduler.AddJob<OneSecondStepProcessor>(IocRegistrations.Configuration); |
20 | | - scheduler.AddJob<TwoSecondStepProcessor>(IocRegistrations.Configuration, startupArgs: "Hello world!!!"); |
21 | | - scheduler.AddJob<OneMinuteStepCrontabProcessor>(IocRegistrations.Configuration); |
22 | | - scheduler.AddJob<TwoParallelTasksProcessor>(IocRegistrations.Configuration, invokeMethodName: "Execute"); |
23 | | - scheduler.AddBasicJob<BasicTaskProcessor>(); |
| 17 | +scheduler.OnJobStart += HandlerDiagnostics.HandlerOnJobStart; |
| 18 | +scheduler.OnJobFinish += HandlerDiagnostics.HandlerOnJobFinish; |
| 19 | + |
| 20 | +scheduler.AddJob<OneSecondStepProcessor>(IocRegistrations.Configuration); |
| 21 | +scheduler.AddJob<TwoSecondStepProcessor>(IocRegistrations.Configuration, startupArgs: "Hello world!!!"); |
| 22 | +scheduler.AddJob<OneMinuteStepCrontabProcessor>(IocRegistrations.Configuration); |
| 23 | +scheduler.AddJob<TwoParallelTasksProcessor>(IocRegistrations.Configuration, invokeMethodName: "Execute"); |
| 24 | +scheduler.AddBasicJob<BasicTaskProcessorAsync>(); |
| 25 | + |
| 26 | +if (await scheduler.StartAsync(args)) |
| 27 | + return; |
24 | 28 |
|
25 | | - if (await scheduler.StartAsync(args)) |
26 | | - return; |
27 | | -} |
28 | 29 |
|
29 | 30 | // Testing some processors without scheduler |
30 | | -using (var scope = DIContainer.Current.BeginLifetimeScope()) |
31 | | - scope.Resolver.Resolve<BasicTaskProcessor>().Run(); |
| 31 | + |
| 32 | +using var scope = DIContainer.Current.BeginLifetimeScope(); |
| 33 | + |
| 34 | +await scope.Resolver.Resolve<BasicTaskProcessorAsync>().Run(); |
0 commit comments