[英]How to delay Eureka client registration with Eureka Server?
I have a Spring Boot
application which is also a Eureka client
. 我有一个Spring Boot
应用程序,它也是一个Eureka client
。 The normal behavior of the application is to register with Eureka server
on start up as UP
. 应用程序的正常行为是在启动时向Eureka server
注册为UP
。 I have a requirement that the application shouldn't register with the Eureka server until smoke testing is completed during deployment. 我要求在部署期间完成烟雾测试之前,应用程序不应向Eureka服务器注册。
Is there a way to delay the registration with Eureka Server or register as OUT_OF_SERVICE
with some type of configuration changes? 有没有办法延迟使用Eureka Server注册或注册为OUT_OF_SERVICE
并进行某些类型的配置更改? I am aware of the Eureka REST endpoints to register, unregister, and change status. 我知道Eureka REST端点可以注册,取消注册和更改状态。
设置eureka.instance.initial-status=OUT_OF_SERVICE
将注册具有该状态的服务。
I had a similar case where I needed my service to perform some preprocessing before indicating that it was available. 我有一个类似的情况,我需要我的服务来执行一些预处理,然后才表明它可用。 I did this by implementing a custom HealthIndicator that starts with a state of OUT_OF_SERVICE and transitions to UP once all of the preprocessing completed. 我这样做是通过实现一个以OUT_OF_SERVICE状态开始的自定义HealthIndicator,并在完成所有预处理后转换为UP。 This always seemed a hack to me but it works. 这对我来说似乎总是一个黑客,但它确实有效。 Hopefully, Spencer can provide better guidance since he is an author in the Spring ecosystem. 希望Spencer能够提供更好的指导,因为他是Spring生态系统的作者。
Are you looking for; 你在找;
eureka.client.initialInstanceInfoReplicationIntervalSeconds=<some N seconds>
This property specifies the initial delay before the clients send health status ie UP etc. 此属性指定客户端发送健康状态(即UP等)之前的初始延迟。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.