使用带有弹簧的石英的配置

发布于 2024-11-25 05:53:43 字数 1457 浏览 0 评论 0原文

我目前使用的是spring框架附带的quartz调度。我们的要求是每天调度一个方法来调用web服务(web服务上只有一个方法)。我的配置如下。

<bean id="downloadJob" 
  class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">

    <property name="targetObject" ref="adapter" />
    <property name="targetMethod" value="getData" />

</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="jobDetails">
        <list>
        <ref bean="downloadJob" />

        </list>
    </property>

    <property name="triggers">
        <list>
        <ref bean="cronTrigger" />
        </list>
    </property>
</bean>

<bean id="cronTrigger"
    class="org.springframework.scheduling.quartz.CronTriggerBean">

    <property name="jobDetail" ref="downloadJob" />
    <property name="cronExpression" value="" /> 

</bean>

我正在从属性文件中读取 cronExpression 值。 请为我提供一些指导,以更好地实施时间表。我在其他一些项目中看到只使用石英而不使用弹簧。他们正在处理线程池和其他一些属性,如下所示。我是第一次从事调度实现。请为我提供一些有关如何处理的建议/指示在使用quartz和spring(org.springframework.scheduling.quartz.SchedulerFactoryBean)时使用以下属性。如果我需要处理除这些之外的任何其他事情,请建议我。

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 15
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true

I am currently using quartz schedular which comes with spring framework.Our requirement is to schedule a method on daily basis which will call a webservice(only one method on the webservice).My configuration is as below.

<bean id="downloadJob" 
  class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">

    <property name="targetObject" ref="adapter" />
    <property name="targetMethod" value="getData" />

</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="jobDetails">
        <list>
        <ref bean="downloadJob" />

        </list>
    </property>

    <property name="triggers">
        <list>
        <ref bean="cronTrigger" />
        </list>
    </property>
</bean>

<bean id="cronTrigger"
    class="org.springframework.scheduling.quartz.CronTriggerBean">

    <property name="jobDetail" ref="downloadJob" />
    <property name="cronExpression" value="" /> 

</bean>

I am reading the cronExpression value from properties file.
Please provide me some pointers to implement the schedular in better way. i have seen in some other projects where only using quartz with out spring.They are taking care of thread pool and some other properties as below.I am first time working on schedular implementation.Please provide me some suggestions/pointers on how to take care of these below properties while using quartz with spring(org.springframework.scheduling.quartz.SchedulerFactoryBean).Please suggest me if i need to take care of anyother things apart from these.

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 15
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅忆 2024-12-02 05:53:43

这是在 Spring 中实现调度程序的好方法。 Spring参考有一个完整的 有关 Quartz 集成的部分应该可以帮助您入门。要设置 Quartz 属性,请使用 SchedulerFactoryBean 的 quartzProperties 属性。您必须通过阅读 Quartz in 自行决定是否还有其他需要注意的事项概述并了解有关 Quartz 配置的更多信息。

That's a fine way to implement a scheduler in Spring. The Spring reference has a whole section on Quartz integration that should help get you started. For setting Quartz properties, use the SchedulerFactoryBean's quartzProperties property. You'll have to decide yourself if there's anything else to take care of by reading up on Quartz in general and learning more about Quartz configuration.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文