我希望能在GAE for Java上以编程方式运行备份作业。 所以我尝试将这里描述的代码移植到Appengine for Java上运行:
Queue queue = QueueFactory.getDefaultQueue();
String backendAddress = BackendServiceFactory.getBackendService().getBackendAddress("ah-builtin-python-bundle");
TaskOptions taskOptions = withUrl("/_ah/datastore_admin/backup.create")
.method(TaskOptions.Method.GET)
.param("name", "Backup_Task")
.param("filesystem", "gs")
.param("gs_bucket_name", "backup_bkt")
.param("queue", queue.getQueueName())
.header("Host", backendAddress).
.param("kind", "customer")
.param("kind", "address")
queue.add(taskOptions);
所有似乎都是正确的。当我运行上面的代码时,它将任务调用添加到推送队列中,但是在我的应用程序的默认版本上执行它,而不是在ah-builtin-python-bundle上执行,这显然会返回404。请参见下面的日志:
2013年10月2日15:58:27.315 /_ah/datastore_admin/backup.create?name=Backup_Task&filesystem=gs&gs_bucket_name=backup&queue=next-version&kind=address&kind=customer 404 26毫秒 0千字节 AppEngine-Google; (+http://code.google.com/appengine) 0.1.0.2 - - [02/Oct/2013:08:58:27 -0700] "GET /_ah/datastore_admin/backup.create?name=Backup_Task&filesystem=gs&gs_bucket_name=backup&queue=next-version&kind=address&kind=customer HTTP/1.1" 404 294 "http://version.myapp.appspot.com/tasks/backup" "AppEngine-Google; (+http://code.google.com/appengine)" "version.myapp.appspot.com" 毫秒=26 cpu_ms=47 cpm_usd=0.000033 queue_name=next-version task_name=3563633336363 app_engine_release=1.8.5 instance=xxxxxxxxxxxxxxx
我也看过这里的代码,它做了相同的事情,但我不确定它是否正常工作。
我想知道,我错过了什么?