Quartz.net Summary (iv) Quartz remote Dispatch

Source: Internet
Author: User


The previous article has described the configuration of quartz.net, the use of the and cron expression expressions. Basically, the timing of the task in the background is completed, and the relevant job can be executed correctly according to the execution plan.

Then, if the task needs to be updated, stop a task? Can not be on the server to change the configuration of the relevant job. Therefore, Quartz.net also provides us with a method of remote dispatch. This time, we briefly introduce the configuration and method of the Quartz.net remote dispatching.

  

  1. Configure Quartz.net remote mode execution

Configure the remote Call Quartz exit on the server on which the task is scheduled, quartz.config add the following configuration

this =555=== Httpquartz

A few notes:
1. The address of the client's "quartz.scheduler.proxy.address" configuration is made up of Channeltype,port and bindname configured on the server. Be careful to keep it consistent.

2. When server initialization starts, the process of initiating the job from the database is not in detail here. Next time I introduce myself to do the task scheduling platform, then elaborate.

3. The job server, in fact, even if a service host, in the background control scheduling all Job execution plan.

2. Managing Clients

A) Create a background-managed client, which can be a Web site. It could be something else.
Initialize all scheduler on the remote server

        Private StaticIScheduler Scheduler =NULL;  Public Static voidInitremotescheduler () {Try{NameValueCollection Properties=NewNameValueCollection (); properties["Quartz.scheduler.instanceName"] ="Schedmaintenanceservice"; properties["Quartz.scheduler.proxy"] ="true"; properties["quartz.scheduler.proxy.address"] =string. Format ("{0}://{1}:{2}/quartzscheduler", scheme, server, port); Ischedulerfactory SF=NewStdschedulerfactory (properties); Scheduler=SF.            Getscheduler (); }            Catch(Exception ex) {Loghelper.writelog ("initialization of remote task Manager failed"+Ex.            StackTrace); }        }        

b) Add, pause, delete tasks, etc.

        /// <summary>        ///pausing a task/// </summary>        /// <param name= "Jobkey" ></param>         Public Static voidPausejob (stringJobkey) {            Try{jobkey JK=NewJobkey (Jobkey); if(Scheduler. Checkexists (JK)) {//Pause Task If task already existsScheduler.                    Pausejob (JK); Loghelper.writelog (string. Format ("task ' {0} ' has been paused", Jobkey)); }            }            Catch(Exception ex) {Throwex; }        }

Here, only said the pause, but the others are similar.

  3. Other

In addition, Quartz.net provides crystal-quartz for remote management. CrystalQuartz.Example.RemoteScheduler.Server example. Interested friends, you can manually configure to see.

Quartz.net Summary (iv) Quartz remote Dispatch

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.