开发者

Running a task in background using Quartz plugin

开发者 https://www.devze.com 2022-12-21 03:24 出处:网络
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 finis

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

精彩评论

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