Korean Job Scheduling (Quartz)

Last updated by admin 4 years ago

?? ??

??

Grails??? ??? ?? ?? ?? Cron ???? ?? ??? ?? ??? ? ????. ?????? Spring? ?? ??? Quartz Enterprise Job Scheduler ? ????? ??? ?? ??(coding by convention) ????? ???? ? ?? ?? ???????.

?? ????

??? ??? ???? "grails create-job" ??? ???? ?? ??? ?????. ??? "grails-app/jobs" ????? ? ??? ??????:
class MyJob {
  def startDelay = 100
  def timeout = 1000

def name = "MyJob" def group = "MyGroup"

def execute(){ print "Job run!" } }

? ????? execute ???? ? ??? ???? ???. 'timeout'? 'startDelay'? ??? ?? ???. ? ? ??? ?? ??? ??? ?????, ?? ??? ???? ?? ?? ????.

Cron ????? ?? ????

??? Cron ???? ?? ??? ?? ????. "cron" ???? ???? "?? ????? ???, ?? 8?? ??" ?? "?? ??? ??? ?? 1? 30??? ??" ??? ??? ??? ? ????. Cron ???? ?? ??? ??? API ?? ? ?????.

class MyJob  {
 def cronExpression = "0 0 6 * * ?"

def name = "MyTask" def group = "MyGroup"

def execute(){ print "Job run!" } }

??? ??(Dependency Injection)? ??

?? ???? ??? ?? ?? ????(auto-wiring)? ???? ??? ??? ?? ?? ??? ??? ??(inject)? ? ????:

def javax.sql.DataSource dataSource
?? ??? ??? ?? ??? ? ????:
def MyService myService
Grails? ?????? ????? ??? ? ??? ???? ?? ???? ??? ?? ??? ?? ?? ?? ??(?, ? ??? ???)? ?? ??? ? ????.