前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >配置Quartz.net Cluster以及远程管理

配置Quartz.net Cluster以及远程管理

作者头像
张善友
发布2018-01-22 15:12:54
1.4K0
发布2018-01-22 15:12:54
举报
文章被收录于专栏:张善友的专栏张善友的专栏

这个例子我们介绍的是使用SQL ServerQuartz.net (version 2.0.2) cluster和crystal-quartz 实现远程管理

我们需要一个SQLServer数据库,Quartz.net 将所有的job details 和triggers 保存到这个数据库,使用Quartz.NET提供的数据库脚本Quartz.net database schema creation script.

image
image

下面我使用crystal-quartz,用它的CrystalQuartz.Example.RemoteScheduler.Server 示例,下面是它的配置

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/>
    </sectionGroup>
  </configSections>
  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging">
        <arg key="showLogName" value="true"/>
        <arg key="showDataTime" value="true"/>
        <arg key="level" value="INFO"/>
        <arg key="dateTimeFormat" value="HH:mm:ss:fff"/>
      </factoryAdapter>
    </logging>
  </common>
  <quartz>
    <add key="quartz.scheduler.instanceName" value="MyScheduler" />
    <add key="quartz.scheduler.instanceId" value="AUTO" />
    <add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
    <add key="quartz.threadPool.threadCount" value="5" />
    <add key="quartz.threadPool.threadPriority" value="Normal" />
    <add key="quartz.jobStore.useProperties" value="true" />
    <add key="quartz.jobStore.clustered" value="true" />
    <add key="quartz.jobStore.misfireThreshold" value="60000" />
    <add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
    <add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
    <add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz" />
    <add key="quartz.jobStore.dataSource" value="myDS" />
    <add key="quartz.dataSource.myDS.connectionString" value="data source=MONOMATRIX\SQLEXPRESS;initial catalog=quartznet;user id=sa;password=*****;multipleactiveresultsets=True;" />
    <add key="quartz.dataSource.myDS.provider" value="SqlServer-20" />
    <add key="quartz.scheduler.exporter.type" value="Quartz.Simpl.RemotingSchedulerExporter, Quartz"/>
    <add key="quartz.scheduler.exporter.port" value="5555"/>
    <add key="quartz.scheduler.exporter.bindName" value="QuartzScheduler"/>
    <add key="quartz.scheduler.exporter.channelType" value="tcp"/>
  </quartz>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

部署一个管理端,具体可以参照 https://github.com/geffzhang/crystal-quartz/tree/master/examples/CrystalQuartz.Examples.RemoteScheduler/CrystalQuartz.Example.RemoteScheduler ,下面是配置,连接到 5555端口进行远程管理:

<configuration>
    <configSections>
        <sectionGroup name="crystalQuartz" type="CrystalQuartz.Web.Configuration.CrystalQuartzConfigurationGroup">
            <section name="provider" type="CrystalQuartz.Web.Configuration.ProviderSectionHandler" requirePermission="false" allowDefinition="Everywhere"/>
        </sectionGroup>
    </configSections>
    <crystalQuartz>
        <provider>
            <add property="Type" value="CrystalQuartz.Core.SchedulerProviders.RemoteSchedulerProvider, CrystalQuartz.Core"/>
            <add property="SchedulerHost" value="tcp://localhost:5555/QuartzScheduler"/>
        </provider>
        <!--    <provider>-->
        <!--      <add property="Type" value="CrystalQuartz.Spring.SpringSchedulerProvider, CrystalQuartz.Spring" />-->
        <!--      <add property="SchedulerName" value="scheduler" />-->
        <!--    </provider>-->
    </crystalQuartz>
    <appSettings/>
    <connectionStrings/>
    <system.web>        
        <httpHandlers>
            <add verb="*" path="CrystalQuartzPanel.axd" type="CrystalQuartz.Web.PagesHandler, CrystalQuartz.Web" validate="false"/>
        </httpHandlers>
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
    <!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <add verb="*" name="CrystalQuartzPanel" path="CrystalQuartzPanel.axd" type="CrystalQuartz.Web.PagesHandler, CrystalQuartz.Web" />
    </handlers>
    </system.webServer>

运行一下就可以看到结果了,这里有一个示例

Quartz.NET的管理工具
Quartz.net官方开发指南 第十一课: 高级(企业级)属性
spring&quartz的项目应用总结

http://geekswithblogs.net/TarunArora/category/13586.aspx

MongoDB provider for Quartz.NET

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2012-12-29 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Quartz.NET的管理工具
  • Quartz.net官方开发指南 第十一课: 高级(企业级)属性
  • spring&quartz的项目应用总结
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档