【发布时间】:2016-03-31 02:37:19
【问题描述】:
我正在使用 spring-cloud-samples/customer-stores 示例并按照描述的方式工作(特别是使用 1.1.0-BUILD-SNAPSHOT)
似乎当事物流向 hystrix 时,它会附加一个源对象,如下所示:
"origin": {
"host": "192.168.60.100",
"port": 9000,
"serviceId": "customers",
"id": "customers:mysql:9000"
}
具体来说,“id”似乎是从serviceId:spring.profiles.active:server.port创建的
当你有几个不同的组合可以使用时,这很好用,但是,当我在不同的 ips 上使用相同的server.port 运行多个服务,或者正在运行多个具有相同 @987654326 的 docker 容器时@,涡轮聚合变得乱码并且毫无意义,因为数据正在自己写。
我想知道 Spring 中是否有一种特定的方式可以在我们的设置中专门影响该 id 的值。
【问题讨论】:
-
所以...看起来这是在
org.springframework.cloud.netflix.hystrix.stream.HystrixStreamTask类中确定的。在对addServiceData()的调用中,它使用Autowired ApplicationContext 并执行getId()。现在的问题似乎是 - 我们可以修改 SpringBoot 使用的 ApplicationContext id 吗?
标签: java spring spring-cloud hystrix turbine