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

Turbine without EurekaDiscovery

Open ghost opened this issue 9 years ago • 5 comments

I'm trying to use spring-cloud-starter-turbine but with a different Discovery (ConfigPropertyBasedDiscovery) but it always use Eureka. Is it possible to use ConfigPropertyBased, FileBasedDiscovery or a CustomBasedDiscovery? Or only with Eureka?

ghost avatar Aug 04 '17 20:08 ghost

application.yml

turbine:
  aggregator:
    clusterConfig: FOO
  clusterNameExpression: 'default'
  appConfig: foo
  instanceUrlSuffix: :9002/hystrix.stream
  ConfigPropertyBasedDiscovery.default.instances: localhost

server:
  port: 8989

ghost avatar Aug 04 '17 20:08 ghost

You should be able to create a bean of type InstanceDiscovery. see https://github.com/spring-cloud/spring-cloud-netflix/blob/master/spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/TurbineHttpConfiguration.java#L62-L83

spencergibb avatar Aug 04 '17 20:08 spencergibb

Thank you very much. Worked fine.

ghost avatar Aug 30 '17 21:08 ghost

Can someone provide a sample? I am providing my own implementation but the TurbineHttpConfiguration is loaded before my beans are created so I can't override what it uses.

devinwhalen avatar May 14 '19 19:05 devinwhalen

My problem was that the turbine documentation says to set the implementation in a config property but this doesn't work. You simple have to create a bean of whatever implementation you want to use like so:

   @Bean
public FileBasedInstanceDiscovery myInstance() {
	return new FileBasedInstanceDiscovery();
}

Just make sure it is in a @Configuration class. At first I just added to my SpringBootApplication class but this doesn't work.

devinwhalen avatar May 15 '19 00:05 devinwhalen