问题
In Backends base app engine project(Java) i was doing
Queue queue = QueueFactory.getQueue("userou-queue");
TaskOptions objTskOptions = TaskOptions.Builder.withUrl("/backendsURL/")
.countdownMillis(2000)
.header("Host", BackendServiceFactory.getBackendService().getBackendAddress("backendname"))
.method(Method.GET);
queue.add(objTskOptions);
But now for Modules How can i target a specific Module for my specific URL.
Please help me.
回答1:
From App Engine documentation:
The following code sample demonstrates how to create a push task addressed to instance 1 of a module named backend1, using the target directive:
import com.google.appengine.api.taskqueue.Queue;
import com.google.appengine.api.taskqueue.QueueFactory;
import static com.google.appengine.api.taskqueue.TaskOptions.Builder.*;
import com.google.appengine.api.backends.*;
// ...
queue.add(withUrl("/path/to/my/worker").param("key", key).header("Host",
BackendServiceFactory.getBackendService().getBackendAddress("backend1", 1));
回答2:
Define the target
parameter in the queue definition file: https://cloud.google.com/appengine/docs/java/config/queue#target
来源:https://stackoverflow.com/questions/27009501/how-to-set-targeted-modules-for-specific-url-in-appengine-java