views:

23

answers:

1

Hi, I'm creating a project that is utilizing Quartz.NET (with ADO.NET DB storage). There is the core component, i.e. the component that executes jobs (console application at the moment, will be a Windows Service), plus multiple web forms where users can add jobs and edit job (edit the datamap values to be specific).

I'm having a bit of an issue with accessing the scheduler from all pages - the core component and the 'add job' page works perfect, with no issues at all. But in them I am essentially doing this in both:

   NameValueCollection properties = new NameValueCollection();

        properties["quartz.scheduler.instanceName"] = "schedService";
        properties["quartz.scheduler.instanceId"] = "sched1";
        properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
        properties["quartz.threadPool.threadCount"] = "10";
        properties["quartz.threadPool.threadPriority"] = "Normal";
        properties["quartz.jobStore.misfireThreshold"] = "60000";
        properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
        properties["quartz.jobStore.useProperties"] = "false";
        properties["quartz.jobStore.dataSource"] = "default";
        properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
        properties["quartz.jobStore.clustered"] = "true";
        // if running MS SQL Server we need this
        properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";

        properties["quartz.dataSource.default.connectionString"] = "Data Source=CHRIS\\SQLEXPRESS;Initial Catalog=Scheduler;Integrated Security=True;Pooling=False";
        properties["quartz.dataSource.default.provider"] = "SqlServer-20";

        ISchedulerFactory schedService = new StdSchedulerFactory(properties);
        IScheduler sched = schedService.GetScheduler();

When I do the same in the edit page, it informs me that there is already a scheduler named this.

I know I'm probably doing something really stupid, but how is there a way I can declare the scheduler in all my pages so I can access them?

A: 

I'm new to Quartz.Net myself, but I'm guessing with clustering set to 'true', you need to use unique names for the scheduler and instances. And I believe what you're getting after is remoting. You should be able to just have one scheduler running and then use remoting to connect to it.

Try this post.

phreak3eb
Thanks buddy, I'll have a try tomorrow and let you know how it goes
Chris