Pregunta

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

¿Fue útil?

Solución

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.

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top