-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discovery metadata #56
Conversation
2e9cc18
to
91951ee
Compare
Probably it's worth getting back to the issue despite the spring-cloud/spring-cloud-netflix#419 and #41 My idea is simply, if the backing discovery service can provide the client with the metadata (like Eureka and Zookeeper) we can cover that, for Consul it could return the tags information for version 1.x and when version 2.0 will be covered the metadata could be provided from there (issues: hashicorp/consul#1131, hashicorp/consul#697, hashicorp/consul#1107). |
At a glance, I think I like this better than #41. |
The only question is whether a "static" Map would be sufficient and won't be a need to do some lookup on the fly and there therefor introduce some InstanceMetadata abstraction. |
When you say, "static" map, do you mean just a |
91951ee
to
c4226ce
Compare
Yes, exactly. I was only deliberating whether introducing there would be a need to introduce some wrapper on top of the map, for instance if you could declare some interface (let's call if InstanceMetadata) then the implementation could have much more flexibility. Although I not sure whether there will be ever need for that, so for now I just propose simple key/value map for storing the metadata. |
@@ -116,7 +113,8 @@ LoadBalancerClient loadBalancerClient() { | |||
|
|||
@Override | |||
public ServiceInstance choose(String serviceId) { | |||
return new DefaultServiceInstance(serviceId, serviceId, random.nextInt(40000), false); | |||
return new DefaultServiceInstance(serviceId, serviceId, random.nextInt(40000), | |||
false, Collections.<String, String>emptyMap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think DefaultServiceInstance
needs to retain the original constructor signature as well as the new one. Hadn't noticed this before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks for noticing.
c4226ce
to
4186f49
Compare
Thanks @jmnarloch! |
@jmnarloch so I started looking at this. The two netflix implementations in |
I'd have to do something like this
@dsyer @adriancole @marcingrzejszczak thoughts? |
The above stinks because it won't work for s-c-zk and s-c-consul, which will use |
Actually we already have a |
And there is a |
* discovery-metadata: Introduced ServiceInstance metadata map.
Closed with some polish via aa2ddce |
The metadata feature is a very good idea. It can be combined together with the "dependency" approach that we have in Zookeeper. |
This pull request introduces the metadata map that can be associated with each service instance registered within discovery service (currently covered by Eureka and Zookeper, Consul is planned to have such support in version 2.0) allowing to use that information on the client side.
I had to also align the version with latest spring boot snapshot where some class has been renamed, this is way there are two commits.