Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top