1

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?

Filip De Vos
  • 11,568
  • 1
  • 48
  • 60
Chris
  • 7,415
  • 21
  • 98
  • 190

1 Answers1

1

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.

Community
  • 1
  • 1
jaryd
  • 861
  • 12
  • 21
  • Thanks buddy, I'll have a try tomorrow and let you know how it goes – Chris Oct 21 '10 at 21:39
  • From the [Quartz.NET Tutorial](http://quartznet.sourceforge.net/tutorial/lesson_11.html): Each node in the cluster MUST have a unique instanceId, which is easily done (without needing different properties files) by placing "AUTO" as the value of this property. – Noah Heldman Jul 25 '12 at 00:37