Esempio n. 1
0
        static void Main(string[] args)
        {
            //Setup
            var resolver = new SimpleResolver();

            MinionConfiguration.Configuration.UseDependencyResolver(resolver);
            MinionConfiguration.Configuration.UseInMemoryStorage();
            //MinionConfiguration.Configuration.UseSqlStorage("<ConnectionString>");

            MinionConfiguration.Configuration.HeartBeatFrequency   = 2000;
            MinionConfiguration.Configuration.NumberOfParallelJobs = 2;
            MinionConfiguration.Configuration.PollingFrequency     = 500;


            var scheduler = new JobScheduler();

            //Add a sequence of jobs
            var sequence = new Sequence();

            sequence.Add <SimpleJob>();
            sequence.Add <JobWithInput, JobWithInput.Input>(new JobWithInput.Input
            {
                Text = "this is awesome!"
            });

            //Queue the sequence
            scheduler.QueueAsync(sequence).Wait();

            //Add a single job
            scheduler.QueueAsync <RecurringJob>();

            //Start the engine
            using (var engine = new BatchEngine())
            {
                Console.WriteLine("Starting ...");

                engine.Start();

                Console.ReadKey();
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //Setup
            var     dateService = new UtcDateService();
            var     store       = new InMemoryStorage(dateService);
            var     resolver    = new SimpleResolver(dateService);
            ILogger logger      = null;
            var     settings    = new BatchSettings
            {
                HeartBeatFrequency   = 2000,
                NumberOfParallelJobs = 2,
                PollingFrequency     = 500
            };

            var scheduler = new JobScheduler(store, dateService);

            //Add a sequence of jobs
            var sequence = new Sequence();

            sequence.Add <SimpleJob>();
            sequence.Add <JobWithInput, JobWithInput.Input>(new JobWithInput.Input
            {
                Text = "this is awesome!"
            });

            //Queue the sequence
            scheduler.QueueAsync(sequence).Wait();

            //Add a single job
            scheduler.QueueAsync <RecurringJob>();

            //Start the engine
            using (var engine = new BatchEngine(store, resolver, logger, settings))
            {
                Console.WriteLine("Starting ...");

                engine.Start();

                Console.ReadKey();
            }
        }