예제 #1
0
        private static void Main(string[] args)
        {
            // IOC container setup

            IocRegistrations.Register();
            DIContainer.Current.Verify();

            // Using scheduler

            using (var scheduler = new MultitaskScheduler())
            {
                scheduler.OnJobStart  += HandlerOnJobStart;
                scheduler.OnJobFinish += HandlerOnJobFinish;

                scheduler.AddJob <OneSecondStepProcessor>(IocRegistrations.Configuration);
                scheduler.AddJob <TwoSecondStepProcessor>(IocRegistrations.Configuration, startupArgs: "Hello world!!!");
                scheduler.AddJob <OneMinuteStepCrontabProcessor>(IocRegistrations.Configuration);
                scheduler.AddJob <TwoParallelTasksProcessor>(IocRegistrations.Configuration, invokeMethodName: "Execute");
                scheduler.AddBasicJob <BasicTaskProcessor>();

                if (scheduler.Start(args))
                {
                    return;
                }
            }

            // Testing some processors without scheduler
            using (var scope = DIContainer.Current.BeginLifetimeScope())
                scope.Resolver.Resolve <BasicTaskProcessor>().Run();
        }
예제 #2
0
        private static void Main(string[] args)
        {
            // IOC container setup

            IocRegistrations.Register()
            .Verify();

            // Using scheduler

            using (var scheduler = new MultitaskScheduler())
            {
                scheduler.OnJobStart  += HandlerOnJobStart;
                scheduler.OnJobFinish += HandlerOnJobFinish;

                scheduler.AddJob <PeriodicalProcessor>(IocRegistrations.Configuration);

                if (scheduler.Start(args))
                {
                    return;
                }
            }

            // Testing without scheduler
            using (var scope = DIContainer.Current.BeginLifetimeScope())
                scope.Resolver.Resolve <PeriodicalProcessor>().Run();
        }