Example of using cloud tasks API from appengine

224 views
Skip to first unread message

dir Ls

unread,
Feb 16, 2019, 7:57:26 PM2/16/19
to google-appengine-go
I am looking for examples of how to use cloud tasks from appengine in golang. The document


only has java, python and javascript. Does anyone have a working example in Go?

Evan Jones

unread,
Feb 18, 2019, 9:08:26 AM2/18/19
to google-appengine-go
If you are using the new Go 111 environment (which I would recommend), you want to use: https://godoc.org/cloud.google.com/go/cloudtasks/apiv2beta3


Hope that helps,

Evan

dir Ls

unread,
Feb 18, 2019, 12:41:04 PM2/18/19
to google-appengine-go
Thank you Evan. I already saw that page. The example had a lot of TODOs and it wasn't readily clear to me what should be filled in those sections. I have working code using appengine task queues and trying to move to the cloud tasks. It also seems like cloud tasks can't be tested locally at this time which is very inconvenient to do local testing.

Evan Jones

unread,
Feb 18, 2019, 12:45:23 PM2/18/19
to google-appengine-go
Oh right. You'll want to look at the Cloud Tasks API documentation for details on what all the parameters are and mean. Its a bit annoying since the Go names are slightly different from the raw protocol buffers APIs, but we managed to get it working with some trial and error. Sorry I don't have an easy example to provide:



And yes, there is no local emulator. You'll have to either write a local stub, like you would to test other things, or test against a real version (e.g. a testing project?)

Good luck,

Evan
Reply all
Reply to author
Forward
0 new messages