How to set targeted Modules for specific URL in Ap

2019-08-23 06:43发布

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.

2条回答
Animai°情兽
2楼-- · 2019-08-23 07:06

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));
查看更多
ゆ 、 Hurt°
3楼-- · 2019-08-23 07:08

Define the target parameter in the queue definition file: https://cloud.google.com/appengine/docs/java/config/queue#target

查看更多
登录 后发表回答