问题描述
背景
我们已经在GAE微服务应用程序上编写了多种服务.一个微服务说Service1(默认)[GAE标准环境中的JAVA]有10个cron作业,另一个微服务说,Service2 [GAE弹性环境中的Python]有5个其他cronjob.
We have written multiple services on GAE microservices application.One micronservice say Service1(default) [JAVA in GAE Standard environment] has 10 cron jobs, wheareas another microservice say, Service2 [Python in GAE Flexible environment] has 5 other cronjobs.
当我们部署这两种服务时,cron作业将被最新的服务cron作业替换.
When we deploy both the services, cron jobs get replaced with the latest service cron jobs.
我知道Task Queue是GAE Microservices中的共享资源,因此也可以共享Cron作业.但是,是否不可能让微服务根据其服务范围拥有专用的cronjob,并将其上传到所有cronjob可以共存的服务器上?
I know that Task Queue is shared resource in GAE Microservices and hence Cron jobs too may be shared. But is it impossible to let microservice have their dedicated cronjobs based on their service scope and get them uploaded on Server where all cronjobs can co-exist?
高度重视及时的回复.
推荐答案
cron配置也是应用程序级别的配置,而不是模块/服务级别的,这就是为什么在为一项服务部署它时,它会覆盖前一个配置的原因来自另一项服务.
The cron configuration is also an application level configuration, not a module/service level one, which is why when you deploy it for one service it overwrites the previous one from another service.
您需要将所有服务的所有cron作业合并到一个cron配置文件中,而是最好使用特定的cron部署命令来部署该文件,而不是将其与特定服务一起上传(有时会因多项服务而失败)应用程序.)
You need to combine all cron jobs for all your services into a single cron configuration file and deploy that one instead, preferably using the specific cron deployment command, not by uploading it together with a particular service (sometimes that fails for multi service apps).
还有其他此类应用程序级别的配置,请参见 https://stackoverflow.com/a/42361987/4495081
There are other such app level configurations as well, see https://stackoverflow.com/a/42361987/4495081
这篇关于GAE微服务,每个微服务都有专用的Cron作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!