I'm using spring-cloud-gateway to dynamically redirect to services registered in consul, but in my case, the same serviceId may have different tags for different instance. For example:
service ID: user-service
instance1 Tags: version: 1.0
instance2 Tags: version: 1.1
my spring cloud configuration looks like:
predicates:
Path='/'+serviceId+'/'+metadata['version']+'/**'
But I DiscoveryClientRouteDefinitionLocator Line 100
.map(instances -> instances.get(0)).filter(includePredicate)
So only one version works, need take metadata into consideration.
Further more, even have different RouteDefinition for different version, gateway can load service, but cannot locate correct version, I guess that is because DiscoveryClient will return all instances according serviceId.
I'm using spring-cloud-gateway to dynamically redirect to services registered in consul, but in my case, the same serviceId may have different tags for different instance. For example: service ID: user-service instance1 Tags: version: 1.0 instance2 Tags: version: 1.1
my spring cloud configuration looks like: predicates:
But I DiscoveryClientRouteDefinitionLocator Line 100
.map(instances -> instances.get(0)).filter(includePredicate) So only one version works, need take metadata into consideration. Further more, even have different RouteDefinition for different version, gateway can load service, but cannot locate correct version, I guess that is because DiscoveryClient will return all instances according serviceId.