0

According to the google doc, a service running in the flexible enviroment can be the target of a push task:

Outside of the standard environment, you can't add tasks to push queues, but a service running in the flexible environment can be the target of a push task. You can specify this using the target parameter when adding a task to queue or by specifying the default target for the queue in queue.yaml.

However, when I tried to do it I get 404 errors in the flexible service.

That's totally normal due to the required endpoint (/_ah/queue/deferred) for task queues is it not defined in the flexible service.

How do I become a flexible service in a valid target for task queues?

Do I have to define that endpoint in my code in some way?

Curro
  • 1,331
  • 1
  • 13
  • 24

1 Answers1

0

Usually, you'll need to write a handler in your worker service to do the processing after receiving a task. In the case of push tasks, the service will send HTTP requests to your whatever url you specify. If no url is specified the default URL /_ah/queue/[QUEUE_NAME] will be used.

Now, from the endpoint you mention, it seems you are using deferred tasks, which are a somewhat special kind. Please, see this thread for a workaround by adding the needed url entry. It mentions Managed VMS but it should still work.

Mar Cial R
  • 936
  • 9
  • 20
  • That workaround is not valid for GAE services in Flexible environment for two reasons: 1- The "handler" directive is not allowed for flex env. 2- The script required (google.appengine.ext.deferred.application) is part of the GAE libraries which don't work on flex, it's exclusive for GAE standard (or old VMs, the one mentioned in the thread) – Curro Oct 11 '17 at 15:15
  • It seems that the only way to make it work is to define the endpoint in my own code (not in yaml ) and develop the proper source code in order to deal with the request from task queues (my own google.appengine.ext.deferred.application) – Curro Oct 11 '17 at 15:18
  • Sorry if I was not clear enough. Handler is an overloaded word. In this case, writing a handler means writing whatever "your own code" is to deal with a matching url. The mapping between URL and handler depends on the framework you use. Regarding the deferred module not working on flex, you might be right as I have not tried myself but was relying on Alex's vast experience. See: https://groups.google.com/forum/#!searchin/google-appengine/Alex$20Martelli$20deferred|sort:relevance/google-appengine/GrprBiHGyns/Skb96WGPBwAJ – Mar Cial R Oct 12 '17 at 11:39