I'm trying to create a task, but it is forwarded to the project's 'default' 
service by informing the URI in setRelativeUri().
What would be the method for defining the specific service in the project?

My Code:

require_once __DIR__ . '/vendor/autoload.php';

use Google\Cloud\Tasks\V2\AppEngineHttpRequest;
use Google\Cloud\Tasks\V2\CloudTasksClient;
use Google\Cloud\Tasks\V2\HttpMethod;
use Google\Cloud\Tasks\V2\Task;

$client = new CloudTasksClient();
$queueName = $client->queueName('MyProject', 'location-id', 'MyQueue');
$httpRequest = new AppEngineHttpRequest();

$httpRequest->setRelativeUri('/script.php'); //Runing on 'default' service. 
How to change?
$httpRequest->setHttpMethod(HttpMethod::GET);

if (isset($payload))
    $httpRequest->setBody($payload);

$task = new Task();
$task->setAppEngineHttpRequest($httpRequest);

$response = $client->createTask($queueName, $task);

printf('Created task %s' . PHP_EOL, $response->getName());


I've tried to change the URI to /app/serviceFolder/script.php, but it does 
not work. Error 404 is returned in the task logs.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/700658fc-f6bc-45dc-893b-3a7810be5433%40googlegroups.com.
  • [google-appengine]... Alisson Linneker

Reply via email to