-
Notifications
You must be signed in to change notification settings - Fork 542
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
Register metadata failed by manual code in Spring Cloud Consul 2020 #696
Comments
The key is not allowed to contain "." |
Sorry,it is Consul limitation, but if we use MetaData key which contains dot(.), Spring Cloud can help me to resolve this issue? Thanks |
@spencergibb this issue difficult to us to resolve, it seems we must replace all "." to "-". My suggestion is that Spring Cloud 2020 merges tags and current metadatas to final metadata. Example there are two configs the special character metadata can be SET with tag, so the final MetaData Map is if tag and metadata configs have the same key, use metadata config BTE, refer to Consul issus links: |
Are your properties set by Spring Cloud consul or some other means? |
Yeah, it seems Consul sidecar does not want to change anything. To our business, MetaData keys are related with our many important outside systems, changing those keys are large workaround to us. so would you please do that enhancement in next 2020 version? That is Spring Cloud fan hope, Many many thanks!! |
Sorry, if i discribe not so cleared, i will try it again if he add new format metadata like that so the final metada is if he SET the final metada still is |
What feature that you want to use depends on metadata? |
User has special character to config with tag, no special character to config with new MetaData fomat. Two operations have same result. What feature that you want to use depends on metadata? for example, using MetaData to do gray relase or blue-green release, or store customs info, like telephone, email etc, like |
If you just want access to tags via service instance and registration that is already available. |
if i config it as tags, getMetadata method return empty in service instance and registration. is that a bug? And those data can be found in getTags method My Idea is getMetadata can get tags data |
It is not a bug. Why do you need it in metadata? |
because in hoxton, we config those with tags, and can get those via getMetadata |
in 2020, we can accept to change those with metadata config, but our MetaData key have ".", Consul Server Side refuses to those. So I have no idea... |
So you could change to use getTags() rather than metadata rather than migrating to use metadata |
According to your suggestion, here we have 2 register middlewares : Eureka and Consul. We provides a common module, it has follows logic: Map<String, String> metadata = instance.getMetadata(); For Eureka it works But for Consul it doesn't works if using getTags, because getTags is not a spring cloud common method it should change to ConsulServiceInstance consulServiceInstance = (ConsulServiceInstance) instance;
List<String> tags = consulServiceInstance.getTags();
Map<String, String> metadata = parseToMetadata(tags); So the common module will not be so generic, we must change a lot of... |
Some business system maybe not use that common module, and I don't how much places shoud do following change ConsulServiceInstance consulServiceInstance = (ConsulServiceInstance) instance;
List<String> tags = consulServiceInstance.getTags();
Map<String, String> metadata = parseToMetadata(tags); |
Would you please add a flag property to enable/disable merging tags to metadata?default value is false, so that use can control that logic by himself |
If I set metadata by code as follows:
The exception will throw out, is it an issue?
If that still use tags, works fine
The text was updated successfully, but these errors were encountered: