简单记录如将tornado注册到eureka, 将tornado引入微服务体系。
使用python-eureka-client
python-eureka-client 项目地址
EUREKA_SERVER_LIST = "http://127.0.0.1:8761/eureka"
SERVER_HOST = "10.10.38.20"
SERVER_PORT = 8000
def register_eureka():
eureka_client.init_registry_client(eureka_server=EUREKA_SERVER_LIST,
app_name="economic-model",
instance_host=SERVER_HOST,
instance_port=SERVER_PORT)
然后在程序的入口函数中调用该方法。
java中调用
- 入口函数添加注解
@EnableFeignClients
- 调用如:
@FeignClient(name = "ECONOMIC-MODEL")
@RequestMapping(value = "/demo")
public interface ITornadoFeignService {
@RequestMapping(value = "/get")
Object getDepartInfo(@RequestParam("phone") String phone, @RequestParam("password") String password);
}