spring-cloud-commons icon indicating copy to clipboard operation
spring-cloud-commons copied to clipboard

SimpleDiscoveryClient does not publish an InstanceRegisteredEvent?

Open gdubya opened this issue 7 years ago • 3 comments

We are developing a collection of services to deploy into an Openshift environment. One of the applications is a simple Spring Cloud Gateway instance.

When developing a service locally (e.g. serviceA) we would like to also test the gateway to access serviceA. We are using the SimpleDiscoveryClient in the Gateway to configure the location of serviceA. We noticed that the SimpleDiscoveryClientAutoConfiguration does not publish a InstanceRegisteredEvent, which means that the DiscoveryClientHealthIndicator is never initialized. Is this intentional?

Our Gateway pom depends on spring-cloud-dependencies Finchley.SR1, which depends on spring-cloud-commons 2.0.1.RELEASE.

gdubya avatar Sep 06 '18 08:09 gdubya

I believe it is a ServiceRegistry that would fire a InstanceRegisteredEvent. I dont see how using a DiscoveryClient would cause that to happen.

ryanjbaxter avatar Sep 06 '18 12:09 ryanjbaxter

That makes sense. But in this case, with SimpleDiscoveryClient, we're not using a service registry (i.e. when developing locally, outside Openshift). In the (deprecated) NoopDiscoveryClientAutoConfiguration there is a method for publishing the event when the context is refreshed.

gdubya avatar Sep 06 '18 12:09 gdubya

Yeah I guess we are technically registering a service(s) in SimpleDiscoveryClientAutoConfiguration. @spencergibb what do you think?

ryanjbaxter avatar Sep 06 '18 16:09 ryanjbaxter