コード例 #1
0
        private static void Main(string[] args)
        {
#if DEBUG
            // Run debugger
            Debugger.Launch();
#endif

            DIContainer.Current.RegisterAll()
            .Verify();

            using (var handler = new MultitaskServiceHandler())
            {
                handler.OnJobStart  += HandlerOnJobStart;
                handler.OnJobFinish += HandlerOnJobFinish;

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

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

            using (var scope = DIContainer.Current.BeginLifetimeScope())
                scope.Resolver.Resolve <BasicTaskProcessor>().Run();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: djoshi001Personal/Simplify
        private static void Main(string[] args)
        {
#if DEBUG
            // Run debugger
            System.Diagnostics.Debugger.Launch();
#endif

            IocRegistrations.Register();

            var handler = new MultitaskServiceHandler();

            handler.AddJob <TaskProcessor1>("TaskProcessor1Settings");
            handler.AddJob <TaskProcessor2>("TaskProcessor2Settings", "Run", true);
            handler.AddJob <TaskProcessor3>("TaskProcessor3Settings", "Run", true);
            handler.AddBasicJob <BasicTaskProcessor>();

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

            using (var scope = DIContainer.Current.BeginLifetimeScope())
                scope.Container.Resolve <BasicTaskProcessor>().Run();
        }