在 Google App Engine (Java) 中使用 Cron 执行后端
我在 GAE 上有一个动态后端设置,我想每 15 分钟使用 cron 运行一次。问题是 cron 需要一个以“/”开头的 url。而后端 URL 使用以下格式:http://backendname.yourapp.appspot.com。
我在其他论坛上读到,您可以使用 fetchurl 来调用后端,但我认为这不是理想的方式。因为这需要您使您的后端可公开访问。
根据谷歌的文档: http://code.google.com/appengine/docs/java /backends/overview.html#Public_and_Private_Backends
<块引用>“应用程序管理员、应用程序实例以及 App Engine API 和服务(例如任务队列任务和 Cron 作业)都可以访问私有后端,无需任何特殊配置。”
有人通过在 cron.xml 中声明来调用后端吗?
I have a Dynamic Backend setup on GAE which I want to run using cron every 15mins. The problem is cron requires a url that begins with "/". While a backend URL uses the following format: http://backendname.yourapp.appspot.com.
I've read in other forums that you could use fetchurl to call your backend but I don't think that's the ideal way. Because that would require you to make your backend publicly accessible.
According to google's documentation:
http://code.google.com/appengine/docs/java/backends/overview.html#Public_and_Private_Backends
"Private backends can be accessed by application administrators, instances of the application, and by App Engine APIs and services (such as Task Queue tasks and Cron jobs) without any special configuration."
Has anybody got backends called by declaring it in cron.xml?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用目标标签在 cron.xml 中指定后端。
Use target tag to specify a backend in your cron.xml.
urlfetch 可用于访问仅限内部使用的 URL,例如私有后端 - 如果不可能,则无法在您的应用程序内进行通信!不过,更好的想法可能是使用任务队列,它可以配置为针对后端运行任务。
urlfetch can be used to access internal-only URLs such as private backends - if that weren't possible, there'd be no way to communicate within your app! A better idea, though, might be to use the Task Queue, which can be configured to run tasks against a backend.
我还没有尝试过谷歌应用程序引擎的后端功能,因为它的定价模型。
不过,根据文档:
http://code.google。 com/appengine/docs/python/backends/overview.html#Public_and_Private_Backends
我认为 GAE 会自动隐藏公共 http 访问的后端 url(即使不需要配置 app.yaml)。您可以通过注销并直接访问后端 url 来测试其行为。
I haven't try google app engine's Backends functions, because its pricing model.
However, according to the documents:
http://code.google.com/appengine/docs/python/backends/overview.html#Public_and_Private_Backends
I think GAE will automatically hide the backend url from public http visiting (even without the needs to configure the app.yaml). You may test its behavior by logout and access the backend url directly.