filter for multi value field
Opened this issue · 7 comments
What if i want to manage a tag cloud e.g.
metadataMa:
tags: one,tow,four
..and i want mathc the instance if any of the tags is "four"
Lists aren't supported, only scalar values.
I know ..for example that eureka.instance.virtual-host-name does support a multi value list (separated by comma) to be able to define more than one alias for the instance
Can you give a hint how to solve (workaround) or implement such feature?
I want allow micro services to register at eureka and setting "list of capabilities" of a specific (device) type, e.g.
"tags: one,tow,four" where "tags" would be an example type and "one,tow,four" the capabilities values the service offers.
I have amicroservices for devices, where a mciroservice appllication name defines the category of service, e.g. "temppocessor" but the "device type's" the application supports will be filtered based on "device type" metadata map list. The Discovery Filter shall then do an filtered routing. I can't use just " the mirmsoservice names" e.g. like "temppocessor-rasberry", because if the same application support also "sparkfun, particle photon ..etc" the names is not useable and also does not support filtering out of the box
Well, in fact it should be easy, you can template the code based on MetadataAwarePredicate and simply flatMap the metadata map entry value by splitting it by comma, afterwards try to find the matching values.
I could try to open up some of the classes, so that it would be more convenient to provide your own rules/predicates.
Sounds great - i think that's a use case some other could also have ;)
Hey,
Please update to version 2.1 (should be available by the end of day in Maven central) and you can register your own bean of type MetadataAwareRule.
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public DiscoveryEnabledRule metadataAwareRule() {
return new MetadataAwareRule(new DiscoveryEnabledPredicate() { ... });
}
Will the filter run before ribbon does its filter for an instance out of possible instances for resilient/balancing?