[英]Quartz plugin installed, but job is not starting in grails
我剛剛安裝了石英插件(quartz2-0.2.2),我使用的是grails-1.3.7。
然后我使用“grails create-job”創建了我的作業類,並修改了它以打印出一條消息作為測試。
class ImportFilesJob {
def startDelay = 100000L
def cronExpression = "0 30 22 * * ?"
def execute() {
log.info"ImportFilesJob start!"
println "ImportFilesJob start!"
Date runDate = DateUtils.today
long start = System.currentTimeMillis()
long end = System.currentTimeMillis()
log.info "Finished ImportFilesJob in ${end - start} millisec."
println"Finished ImportFilesJob in ${end - start} millisec."
}
}
現在,我預計這項工作將在每天晚上10點30分開始。
但事實並非如此......
我錯過了什么嗎?
Thanx任何幫助。
Nimmy
這是在你的“測試”環境中嗎? 如果是這樣,Quartz配置為不在測試中自動啟動。 檢查QuartzConfig.groovy文件並進行設置
autoStartup = true
並且要等到10:30之后再次檢查,您可以使用以下cron表達式每隔3分鍾啟動它,看看它是否正常工作:
“0 0/3 * * *?”
我想你忘記了“觸發器”塊:
class MyFirstJob{
def concurrent = false
static triggers = {
simple name: 'myFirstJobTrigger', startDelay: 1000, repeatInterval: 1000 }
def group = "MyGroup"
def execute(){
println "MyFirstJob run!"
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.