【问题标题】:Request microservice to another microservice向另一个微服务请求微服务
【发布时间】:2020-09-03 05:18:11
【问题描述】:
我正在将我的项目从 ComputeEngine 迁移到 AppEngine,在 ComputeEngine 中我定义了每个服务可以使用的端口。所以在互相交流的时候,我所做的就是用一个简单的 localhost 来称呼他们:端口,一切都是幸福的;直到我必须在 AppEngine 中做同样的事情,我才发现我无法识别我已部署的每个服务的本地 url。
我认为,由于会产生网络流量,因此在部署每个服务时定义生成的公共 url (..appspot.com) 不是一个好主意。
【问题讨论】:
标签:
java
spring
google-app-engine
【解决方案1】:
使用dispatch.yaml,您可以确定哪个服务为每个网址提供服务:
dispatch: # don't forget: gcloud app deploy dispatch.yaml after changes !!!
- url: "*/urls/that/need/more/RAM/" # note wildcard capability
service: service_1
- url: "urls/that/need/more/speed/*" # note wildcard capability
service: service_2
- url: "service_1.app_name.appspot.com/*" # this should match cron calls to service_1 target
service: service_1
- url: "*/.*"
service: default