spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
813 stars 541 forks source link

Dynamic Tags for service registration #109

Open mishadoff opened 8 years ago

mishadoff commented 8 years ago

Is there a way to set spring.cloud.consul.discovery.tags programmatically based on some application logic?

My use case is following: I have some bootstrap.jar application which runs with -Dloader.path for additional jars as dynamic components. Each dynamic component has a specific interface, annotation @Component and a name. I want to expose all component names as a tags during service registration.

spencergibb commented 8 years ago

No, there's not.

mishadoff commented 8 years ago

It is a pity. Do you plan to add support for this at some point? Or any workarounds?

spencergibb commented 8 years ago

You just opened the issue :-)

spencergibb commented 8 years ago

Pull requests are welcome.

venilnoronha commented 8 years ago

As discussed on #168, this behavior can be achieved by extending ConsulLifecycle and overriding the register(NewService) method.