How To Programmatically Create & Pause Google App Engine Task Queues

老子叫甜甜 提交于 2019-12-23 12:17:49

问题


I'm using Google App Engine and I've been using a named push queue to process some tasks. The queue was defined and configured using queue.xml. That's fine.

Now I'm trying to do more:

1) Is there a way to dynamically create and configure a new queue in Java "on the fly"?

2) Also, once I have a queue (either through queue.xml or 1) if possible), is there a way to pause and resume the queue in Java (just like you can do using the admin console buttons)?

Thanks!


回答1:


1) since it has to be in the queue.xml and uploaded with your app, I can't think of a way to do it. As mentioned here: "An app can only add tasks to queues defined in queue.xml and the default queue."

2) in the same page, just a bit further down, you can see that if you set the processing rate of 0, it will pause your queue. To resume, just change it back to something else. Unfortunately that is all done through the xml, not through your code directly.

You might want to take this to Google's Public Issue Tracker as a Feature Request.




回答2:


You can run "gcloud app deploy queue.yaml" in a script to programmatically edit the queue.yaml which in turn creates / modifies Push Queues.



来源:https://stackoverflow.com/questions/28372998/how-to-programmatically-create-pause-google-app-engine-task-queues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!