2014-02-12 31 views
0

我已經在quartz.properties以下配置集羣石英觸發由駱駝暫停在關機時

org.quartz.scheduler.instanceId=AUTO 
org.quartz.scheduler.instanceName=JobCluster 

org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX 
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate 
org.quartz.jobStore.dataSource=myDataSource 
org.quartz.dataSource.chargebackDataSource.jndiURL=jdbc/myDataSource 

org.quartz.jobStore.isClustered=true 
org.quartz.threadPool.threadCount=5 

Spring的配置是這樣的:

<bean id="quartz2" class="org.apache.camel.component.quartz2.QuartzComponent"> 
    <property name="propertiesFile" value="quartz.properties"/> 
</bean> 

    <route> 
     <from uri="quartz2://myTrigger?job.name=myJob&amp;job.durability=true&amp;stateful=true&amp;trigger.repeatInterval=60000&amp;trigger.repeatCount=-1"/> 
     <to uri="bean:myBean?method=retrieve"/> 
.... 

在關閉應用程序改變了石英觸發狀態到PAUSED並在下一次開始後再也沒有改變爲WAITING,所以再也沒有開火。

在應用程序重新啓動之後,是否可以配置quartz/camel以某種方式恢復觸發器?

  • 駱駝版本是2.12.0。

    如果您在集羣模式下使用Quartz,例如:

  • Spring版本3.2.4.RELEASE

其實這種行爲在指南與theit說法矛盾JobStore被聚集。那麼當節點停止/關閉時,Quartz2組件不會暫停/刪除觸發器。這允許觸發器繼續在集羣中的其他節點上運行。

回答

0

如果要動態掛起/恢復路線作爲

org.apache.camel.impl.ThrottlingRoutePolicy 

不那麼它建議使用org.apache.camel.SuspendableService,因爲它允許細粒度的暫停和恢復操作。並且使用org.apache.camel.util.ServiceHelper來協助調用這些操作,因爲它支持常規org.apache.camel.Service instances的後備。

欲瞭解更多詳情,請參閱RoutePolicyQuartz Component

希望這migh幫助

+0

謝謝你的答覆。實際上,我會假設Camel應該有一個選項來重新啓動應用程序後恢復石英觸發器,否則Camel-Quartz集成沒有意義,如果它不支持重新啓動,並且您必須手動將數據庫中的觸發器狀態更改爲WAITING。 –