More simplifications in fabric8 discovery implementation#1403
More simplifications in fabric8 discovery implementation#1403ryanjbaxter merged 40 commits intospring-cloud:3.0.xfrom wind57:more-simplifications
Conversation
| * - service type | ||
| * </pre> | ||
| */ | ||
| public static Map<String, String> serviceMetadata(String serviceId, Map<String, String> serviceLabels, |
There was a problem hiding this comment.
-
we are modifying a public method here, but one which was never released, it was introduced a few commits back. That is one of the reasons I did not start this work before, but only after the previous release, so that I have enough time to potentially change method signatures, after some clean-up.
-
What this change does is encapsulate 3 fields:
serviceId(service name)serviceLabelsserviceAnnotations
into a single record : ServiceMetadata. This class already existed under a different name, also introduced recently and not released yet.
|
|
||
| public static ServicePortNameAndNumber endpointsPort(LinkedHashMap<String, Integer> endpointsPorts, | ||
| String serviceId, KubernetesDiscoveryProperties properties, Map<String, String> serviceLabels) { | ||
| ServiceMetadata serviceMetadata, KubernetesDiscoveryProperties properties) { |
There was a problem hiding this comment.
same here, instead of
serviceIdMap<String, String> serviceLabels
pass a single ServiceMetadata instance
| * | ||
| * @author wind57 | ||
| * | ||
| */ | ||
| public record ServiceMetadataForServiceInstance(String name, Map<String, String> labels, |
There was a problem hiding this comment.
rename a public record not yet released + add two more fields to it.
| List<EndpointAddress> addresses = addresses(endpointSubset, properties); | ||
| for (EndpointAddress endpointAddress : addresses) { | ||
|
|
||
| ServiceMetadataForServiceInstance forServiceInstance = forServiceInstance(service); |
There was a problem hiding this comment.
here is one improvement that I did not notice until the clean-up was made. This line:
ServiceMetadataForServiceInstance forServiceInstance = forServiceInstance(service);
was computed in a loop of :
for (EndpointSubset endpointSubset : subsets) {
though it's only needed once. So I extracted it before it:
ServiceMetadata serviceMetadata = serviceMetadata(service);
Otherwise the changes here are related to renaming the ServiceMetadata record.
|
@ryanjbaxter this is ready to go too. thank you. |
No description provided.