There are 2 methods for explicitly defining a target service [1]: declaring in the task itself or routing all tasks in a queue. Setting AppEngineRouting in AppEngineHttpRequest is indeed the preferred method for routing specific tasks to other services.
A few points are worth noting which may affect why the routing is not behaving as you intend: 1- As noted here [2], the appengine.applications.get IAM permission is required to use AppEngineRouting. 2- As noted here [3], āappEngineRoutingOverrideā has priority in that if this is set on a queue pointing to a specific service, all tasks in a queue will have their target set to that service even if the AppEngineRouting is set at the individual level. 3- Configuring routing can be done against App Engine queues only [4] If you wish to set up routing at the queue level, please try using the gcloud command to see if this is successful: gcloud tasks queues update [QUEUE_ID] \ --routing-override =service:[SERVICE],version:[VERSION] [1] https://cloud.google.com/tasks/docs/configuring-queues#routing [2] https://cloud.google.com/tasks/docs/reference/rest/v2/AppEngineRouting[3] https://cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#AppEngineHttpRequest.FIELDS.app_engine_routing [4] https://cloud.google.com/tasks/docs/configuring-queues#routing On Friday, November 29, 2019 at 5:58:56 PM UTC-5, Pardeep Aulakh wrote: > > Hi, > > How can I send a task to a different service in Cloud Task. I tried with > `app_engine_routing` value in AppEngineHttpRequest, but the task is still > executing in the same service (which I was able to verify from logs). > I am using `google.cloud.tasks.CloudTasksClient` lib in Python 37 runtime > environment in GAE. > > > Thanks in advance, > -- 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/b6e6e839-be78-47d9-acdc-fe7a1e974f99%40googlegroups.com.