开发者

Running a task in background using Quartz plugin

I'm planning to have a view that presents a button so that when it is clicked, it will run a Quartz job and the page will finish loading successfully (no need to wai开发者_C百科t for the job to finish). Based on this documentation, you can have a custom trigger class. Can you help me implementing it?

My job:

class ReconciliationJob {
    static triggers = {
        custom name:'customTrigger', triggerClass:ReconciliationTrigger, targetDate:myValue
    }


    def execute() {
        // execute task
    }
}

How can I implement ReconciliationTrigger class? Also, I need to pass a parameter to the job too.

Thanks.


I think you've mixed up jobs and queues.

Quartz jobs are background tasks which run on a time-based trigger and are not designed to be kicked off by user-driven events.

Queues, such as JMS, allow you to send an asynchronous 'message' (method call) in the manner you describe. Take a look at the Grails JMS plugin and it might be what you're looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜