I wanted to run backup jobs programmatically on GAE for Java. So I have tried to port the code described here to work on 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);
All that seems correct. When I run the above code it adds the task call to push quueue, however doesn't execute it on ah-builtin-python-bundle, but on the default version of my app, which obviously returns 404. See logs below:
2013-10-02 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 26ms 0kb 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" ms=26 cpu_ms=47 cpm_usd=0.000033 queue_name=next-version task_name=3563633336363 app_engine_release=1.8.5 instance=xxxxxxxxxxxxxxx
I have also seen code here which is doing the same, but I am not sure if it works correctly.
I wonder, what am I missing?