Can we specify Cron jobs dynamically? I want to define a task to occur at some time in future .How can I achieve that functionality? This is need to be done in Google App Engine. The ony way that I have found is to do polling

有帮助吗?

解决方案

You can use Task Queues, as described here. Task queues have the same duration constraint of Cron Jobs (10 minutes), and you can specify the time at which the Task will be executed with the countdownMillis method on the TaskOptions object. For example:

Queue myQueue = QueueFactory.getQueue("myQueue");
myQueue.add(TaskOptions.Builder.withUrl("/myTask").countdownMillis(2000));

will delay the execution of the task at URL /myTask on the queue myQueue by 2 seconds. Have a look here to understand how to properly configure a task queue for your needs.

其他提示

Yes use task queues. Use countdown for example to control when it starts.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top