File tree Expand file tree Collapse file tree 11 files changed +162
-9
lines changed
Examples/Simplify.Scheduler.SimpleApp
Simplify.Scheduler.IntegrationTester Expand file tree Collapse file tree 11 files changed +162
-9
lines changed Original file line number Diff line number Diff line change 3535* .vspscc
3636* .vssscc
3737.builds
38+ out /
3839
3940# Visual C++ cache files
4041ipch /
Original file line number Diff line number Diff line change 1+ # build
2+
3+ docker build -t simplify.scheduler.simpleapp .
4+
5+ # run
6+
7+ docker run -ti --name "simplify.scheduler.simpleapp" simplify.scheduler.simpleapp
8+
9+ # stop
10+
11+ ctrl + C
12+
13+ # logs
14+
15+ docker logs simplify.scheduler.simpleapp
Original file line number Diff line number Diff line change 1+ # build
2+
3+ FROM mcr.microsoft.com/dotnet/core/sdk:3.1 as build
4+ WORKDIR /src
5+
6+ COPY . .
7+ RUN dotnet publish -f netcoreapp3.1 -c release -o out
8+
9+ # launch
10+
11+ FROM mcr.microsoft.com/dotnet/core/runtime:3.1
12+ WORKDIR /app
13+
14+ COPY --from=build /src/out /app
15+ CMD dotnet Simplify.Scheduler.SimpleApp.dll
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace Simplify . Scheduler . SimpleApp
4+ {
5+ public class PeriodicalProcessor : IDisposable
6+ {
7+ public void Run ( )
8+ {
9+ Console . WriteLine ( "PeriodicalProcessor launched" ) ;
10+ }
11+
12+ public void Dispose ( )
13+ {
14+ Console . WriteLine ( "PeriodicalProcessor disposed" ) ;
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using Simplify . DI ;
3+ using Simplify . Scheduler . SimpleApp . Setup ;
4+
5+ namespace Simplify . Scheduler . SimpleApp
6+ {
7+ internal class Program
8+ {
9+ private static void Main ( string [ ] args )
10+ {
11+ // IOC container setup
12+
13+ IocRegistrations . Register ( ) . Verify ( ) ;
14+
15+ // Using scheduler
16+
17+ using ( var scheduler = new MultitaskScheduler ( ) )
18+ {
19+ scheduler . OnJobStart += HandlerOnJobStart ;
20+ scheduler . OnJobFinish += HandlerOnJobFinish ;
21+
22+ scheduler . AddJob < PeriodicalProcessor > ( IocRegistrations . Configuration ) ;
23+
24+ if ( scheduler . Start ( args ) )
25+ return ;
26+ }
27+
28+ // Testing without scheduler
29+ using ( var scope = DIContainer . Current . BeginLifetimeScope ( ) )
30+ scope . Resolver . Resolve < PeriodicalProcessor > ( ) . Run ( ) ;
31+ }
32+
33+ private static void HandlerOnJobStart ( Jobs . ISchedulerJobRepresentation representation )
34+ {
35+ Console . WriteLine ( "Job started: " + representation . JobClassType . Name ) ;
36+ }
37+
38+ private static void HandlerOnJobFinish ( Jobs . ISchedulerJobRepresentation representation )
39+ {
40+ Console . WriteLine ( "Job finished: " + representation . JobClassType . Name ) ;
41+ }
42+ }
43+ }
Original file line number Diff line number Diff line change 1+ using Microsoft . Extensions . Configuration ;
2+ using Simplify . DI ;
3+
4+ namespace Simplify . Scheduler . SimpleApp . Setup
5+ {
6+ public static class IocRegistrations
7+ {
8+ public static IConfiguration Configuration { get ; private set ; }
9+
10+ public static IDIContainerProvider Register ( )
11+ {
12+ DIContainer . Current . RegisterConfiguration ( )
13+ . Register < PeriodicalProcessor > ( ) ;
14+
15+ return DIContainer . Current ;
16+ }
17+
18+ private static IDIRegistrator RegisterConfiguration ( this IDIRegistrator registrator )
19+ {
20+ Configuration = new ConfigurationBuilder ( )
21+ . AddJsonFile ( "appsettings.json" , false )
22+ . Build ( ) ;
23+
24+ registrator . Register ( p => Configuration , LifetimeType . Singleton ) ;
25+
26+ return registrator ;
27+ }
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+ <PropertyGroup >
3+ <TargetFrameworks >netcoreapp3.1</TargetFrameworks >
4+ <Version >1.0</Version >
5+ <Authors >Alexander Krylkov</Authors >
6+ <Product >Simplify</Product >
7+ <Description >Simplify.Scheduler simple app</Description >
8+ <Copyright >Licensed under LGPL</Copyright >
9+ <OutputType >Exe</OutputType >
10+ <IsPackable >false</IsPackable >
11+ </PropertyGroup >
12+ <ItemGroup >
13+ <PackageReference Include =" Microsoft.Extensions.Configuration.Json" Version =" 3.1.5" />
14+ <PackageReference Include =" Simplify.Scheduler" Version =" 1.0.0-pre05" />
15+ </ItemGroup >
16+ <ItemGroup >
17+ <None Update =" appsettings.json" >
18+ <CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
19+ </None >
20+ </ItemGroup >
21+ </Project >
Original file line number Diff line number Diff line change 1+ {
2+ "PeriodicalProcessorSettings" :
3+ {
4+ "ProcessingInterval" : 5
5+ }
6+ }
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22 <PropertyGroup >
3- <TargetFrameworks >netcoreapp2.2 </TargetFrameworks >
3+ <TargetFrameworks >netcoreapp3.1 </TargetFrameworks >
44 <Authors >Alexander Krylkov</Authors >
55 <Product >Simplify</Product >
66 <Description >Simplify.Scheduler integration tester</Description >
1111 <IsPackable >false</IsPackable >
1212 </PropertyGroup >
1313 <ItemGroup >
14- <PackageReference Include =" Microsoft.Extensions.Configuration.Json" Version =" 3.1.3 " />
14+ <PackageReference Include =" Microsoft.Extensions.Configuration.Json" Version =" 3.1.5 " />
1515 <ProjectReference Include =" ..\Simplify.Scheduler\Simplify.Scheduler.csproj" />
1616 </ItemGroup >
1717 <ItemGroup >
Original file line number Diff line number Diff line change 55 <Product >Simplify</Product >
66 <Description >Scheduler framework with DI</Description >
77 <Copyright >Licensed under LGPL</Copyright >
8- <Version >1.0-pre05 </Version >
8+ <Version >1.0</Version >
99 <PackageProjectUrl >https://github.com/SimplifyNet/Simplify/wiki/Simplify.Scheduler</PackageProjectUrl >
1010 <PackageIconUrl >https://raw.githubusercontent.com/SimplifyNet/Images/master/Logo.png</PackageIconUrl >
1111 <RepositoryUrl >https://github.com/SimplifyNet/Simplify/tree/master/src/Simplify.Scheduler</RepositoryUrl >
1212 <PublishRepositoryUrl >true</PublishRepositoryUrl >
1313 <PackageTags >.NET Scheduler DI</PackageTags >
1414 <PackageReleaseNotes >
15- Bug fixes
16- * Crontab timer period set to 1000 msec (#38)
17- Updates
18- * Microsoft.Extensions.Configuration upgrade to 3.1.0
15+ Updates (changes from 1.0.0-pre05)
16+ * Microsoft.Extensions.Configuration upgrade to 3.1.5
17+ * Simplify.DI upgrade to 4.0.4
1918 </PackageReleaseNotes >
2019 <OutputPath >bin\Any CPU\$(Configuration)\</OutputPath >
2120 <EmbedUntrackedSources >true</EmbedUntrackedSources >
2524 </PropertyGroup >
2625 <ItemGroup >
2726 <PackageReference Include =" ncrontab" Version =" 3.3.1" />
28- <PackageReference Include =" Simplify.DI" Version =" 4.0.0 " />
27+ <PackageReference Include =" Simplify.DI" Version =" 4.0.4 " />
2928 <PackageReference Include =" Simplify.System" Version =" 1.2.0" />
30- <PackageReference Include =" Microsoft.Extensions.Configuration" Version =" 3.1.0 " />
29+ <PackageReference Include =" Microsoft.Extensions.Configuration" Version =" 3.1.5 " />
3130 </ItemGroup >
3231</Project >
You can’t perform that action at this time.
0 commit comments