Is it possible to assign a property for cronExpression value as below class
RecursiveNotificationJob {
def reminderService;
def grailsApplication
String cronValue = "0 0 8 * * ?"
static triggers = {
cron name: 'recursiveNotificationTrigger', cronExpression: cronValue
}
def execute() {
println new Date().toString() +" Recursive Notification Job is working";
reminderService.execute();
}
}
In fact I would like to have the cronExpression value to be configured and called from a table as my example below
class RecursiveNotificationJob {
def reminderService;
def grailsApplication
String cronValue = Parameter.executeQuery("select value from Parameter where name='RecursiveNotification'");
static triggers = {
cron name: 'recursiveNotificationTrigger', cronExpression: cronValue
}
def execute() {
println new Date().toString() +" Recursive Notification Job is working";
reminderService.execute();
}
}
Both of them doesn't work seem. Appreciate any idea or suggestion how this can be done in proper way? Thanks