Skip to content

Commit 4e96bc2

Browse files
committed
Scheduler events integration tests
1 parent 94d4d7c commit 4e96bc2

File tree

1 file changed

+15
-1
lines changed
  • src/Simplify.Scheduler.IntegrationTester

1 file changed

+15
-1
lines changed

src/Simplify.Scheduler.IntegrationTester/Program.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Simplify.DI;
1+
using System;
2+
using Simplify.DI;
23
using Simplify.Scheduler.IntegrationTester.Setup;
34

45
namespace Simplify.Scheduler.IntegrationTester
@@ -16,6 +17,9 @@ private static void Main(string[] args)
1617

1718
using (var scheduler = new MultitaskScheduler())
1819
{
20+
scheduler.OnJobStart += HandlerOnJobStart;
21+
scheduler.OnJobFinish += HandlerOnJobFinish;
22+
1923
scheduler.AddJob<OneSecondStepProcessor>(IocRegistrations.Configuration);
2024
scheduler.AddJob<TwoSecondStepProcessor>(IocRegistrations.Configuration, startupArgs: "Hello world!!!");
2125
scheduler.AddJob<OneMinuteStepCrontabProcessor>(IocRegistrations.Configuration);
@@ -30,5 +34,15 @@ private static void Main(string[] args)
3034
using (var scope = DIContainer.Current.BeginLifetimeScope())
3135
scope.Resolver.Resolve<BasicTaskProcessor>().Run();
3236
}
37+
38+
private static void HandlerOnJobStart(Jobs.ISchedulerJobRepresentation representation)
39+
{
40+
Console.WriteLine("Job started: " + representation.JobClassType.Name);
41+
}
42+
43+
private static void HandlerOnJobFinish(Jobs.ISchedulerJobRepresentation representation)
44+
{
45+
Console.WriteLine("Job finished: " + representation.JobClassType.Name);
46+
}
3347
}
3448
}

0 commit comments

Comments
 (0)