How to execute task in Google App Engine
I am trying to execute task in one of Google App Engine project automatically using Java.
To create task , i did following steps.
Step 1) Created one servlet by extending HTTPServlet with url pattern in web.xml is /task.
I written following code inside doGet() of this servlet to add task
to default queue.
Queue q = QueueFactory.getDefaultQueue();
q.add(TaskOptions.Builder.withUrl("/test").param("key", "123"));
开发者_开发技巧Step 2) Created one more servlet by extending HTTPServlet with url pattern in web.xml is /test.
I written sent email code when this servlet is exceuted.
So now, I added task to queue with url test.
When my task will execute.
When i execute servlet with url pattern /task it is adding task to queue. But task is not executing.
How my task will execute automatically by Google App Engine.
Thanks.
the task should execute.
go to your google app engine administration console and check your logs and task queues. it's either exceptions or task completed. if completed, it may not show up on the task queue (unless it finished within the past 1 min).
to verify that your task has been submitted successfully, you can try the following:
- use the administration console and pause the task queue
- submit your task to the task queue (by accessing the url e.g. http://your.appspot.com/task)
- go to the administration console and check the task queue. Under the 'Tasks in Queue' column, you should see that the task is still pending.
精彩评论