简体   繁体   English

Go中的AppEngine标准环境发布/订阅上下文

[英]AppEngine Standard Environment Pub/Sub Context in Go

Trying to get Pub/Sub working in AppEngine Standard Environment. 试图在AppEngine标准环境中使Pub / Sub工作。 Having problems getting the right context. 在获得正确的上下文时遇到问题。 The Pub/Sub client wants a context.Context but AppEngine only has appengine.Context . Pub / Sub客户端需要一个context.Context但是AppEngine仅具有appengine.Context Can't find any examples or anything related to this, except for flexible environment (using context.Background ) which I don't want to use. 除了我不想使用的灵活环境(使用context.Background )以外,找不到任何示例或与此相关的任何内容。 Am I the only person on the planet wanting to use Pub/Sub with AppEngine Standard Environment? 我是地球上唯一想要在AppEngine标准环境中使用Pub / Sub的人吗?

Ultimately I was using the wrong appengine . 最终我使用了错误的appengine As of now, I have to import google.golang.org/appengine like the examples for Go 1.9 . 截至目前,我必须像Go 1.9示例一样导入google.golang.org/appengine This is because I was providing appengine.context when I needed context.Context . 这是因为我在需要context.Context时提供了appengine.context

context.Context was introduced in Go 1.7 (2016) . context.ContextGo 1.7(2016)中引入。 appengine.NewContext was changed to return context.Context in 2017 . appengine.NewContext已更改为2017年返回context.Context

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Cloud Pub/Sub:使用 GAE/Go 标准拉取订阅者 - Cloud Pub/Sub: Pull subscriber with GAE/Go Standard Google Cloud Pub / Sub与Standard Java环境的集成 - Google cloud pub/sub integration with Standard java environment 是否可以从App Engine标准环境访问Google Pub / Sub? - Access Google Pub/Sub from App Engine standard environment? go112 标准运行时中 appengine 任务队列的正确上下文是什么 - What is the correct context for appengine taskqueue in go112 standard runtime Google Appengine对pub sub的请求出错 - Error in request from Google Appengine to pub sub 在AppEngline上运行时,将Cloud Firestore与AppEngine Go标准环境配合使用会返回rpc错误 - Using Cloud Firestore with AppEngine Go Standard Environment returns rpc error when running on AppEngline 如何在标准环境中使用Appengine Gradle插件 - How to use Appengine Gradle Plugin with standard environment 在AppEngine标准环境中使用Java创建线程 - Creating Threads with java in AppEngine Standard Environment AppEngine Python 3.7 标准环境上的 Websockets? - Websockets on AppEngine Python 3.7 standard environment? 在AppEngine Node.js标准环境中稳定快速会话 - Stabilizing express session on AppEngine Node.js Standard environment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM