我可以从作业文件夹中的静态触发器运行 cron,它会执行,但是当我尝试从控制器触发触发器时,它只是失败了......我错过了什么?
错误代码:没有方法签名:静态 com.example.TaskReminderJob.triggerNow() 适用于参数类型:(java.util.LinkedHashMap) 值:[[params:[name:Frank, email:frank@test.com] ]]
grails-app/jobs/example 中的 Quartz Job
package com.example
class TaskReminderJob {
def reminderMailService
static triggers = { }
def execute(context) {
def email = context.mergedJobDataMap.get('email')
def name = context.mergedJobDataMap.get('name')
reminderMailService.remindMail1(name, email) //send email via service
}
}
控制器调用工作
package example
class UserController {
def quartzScheduler
...
//user is created
...
TaskReminderJob.triggerNow([name:"frank",email:"frank@test.com"] )
}