コード例 #1
0
ファイル: Startup.cs プロジェクト: bradriese77/QuartzLinux
        public void Configuration(IAppBuilder app)
        {
            Scheduler = new SchedulerFacade();

            QuartzServiceLib.QuartzJobStoreSettings quartzJobStoreSettings = new QuartzServiceLib.QuartzJobStoreSettings(true);
            NameValueCollection properties = quartzJobStoreSettings.GetQuartzSettings();

            properties["quartz.scheduler.proxy"]         = "true";
            properties["quartz.scheduler.proxy.address"] = "tcp://localhost:555/QuartzScheduler";
            StdSchedulerFactory stdSchedulerFactory = new StdSchedulerFactory(properties);

            SchedulerFacade.Scheduler = stdSchedulerFactory.GetScheduler().Result;


            app.UseCrystalQuartz(() => Scheduler);
        }
コード例 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }
            // var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
            //XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));
            //_log.Info("Starting Quartz");
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            QuartzServiceLib.QuartzJobStoreSettings s      = new QuartzServiceLib.QuartzJobStoreSettings(true);
            QuartzServiceLib.QuartzWrapper          quartz = new QuartzServiceLib.QuartzWrapper(s.GetQuartzSettings());

            QuartzServiceLib.QuartzProgram <Startup> .ScheduleReflectionJobTypes(QuartzServiceLib.QuartzProgram <Startup> .GetJobTypes());

            quartz.StartQuartz();
            IScheduler scheduler = quartz.Scheduler;//new CrystalQuartz.Core.SchedulerProviders.RemoteSchedulerProvider() {SchedulerHost=s.QuartzTcpServer }.CreateScheduler()

            //app.UseCrystalQuartz(new RemoteSchedulerProvider()
            //{
            //    SchedulerHost = "tcp://10.0.0.11:555/QuartzScheduler",
            //});


            app.UseCrystalQuartz(() => scheduler);
            app.UseQuartzmin(new QuartzminOptions()
            {
                // VirtualPathRoot = "QuartzMin",
                Scheduler = scheduler
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }