in discovery/mdns/src/main/java/org/apache/aries/rsa/discovery/mdns/MdnsDiscovery.java [226:271]
public void serviceResolved(ServiceEvent event) {
ServiceInfo info = event.getInfo();
String infoUuid = info.getPropertyString("frameworkUuid");
if(infoUuid == null || infoUuid.equals(fwUuid)) {
// Ignore until we can see if this is for our own endpoint
return;
}
String scheme = info.getPropertyString("scheme");
if(scheme == null) {
scheme = "http";
}
String path = info.getPropertyString("path");
if(path == null) {
// Not a complete record yet
return;
}
int port = info.getPort();
if(port == -1) {
switch(scheme) {
case "http":
port = 80;
break;
case "https":
port = 443;
break;
default:
LOG.error("Unknown URI scheme advertised {} by framework {} on host {}",
scheme, info.getName(), info.getDomain());
}
}
String address = info.getInetAddresses()[0].getHostAddress();
String uri = String.format("%s://%s:%d/%s", scheme, address, port, path);
LOG.info("Discovered remote at {}", uri);
namesToUris.put(info.getKey(), uri);
interestManager.remoteAdded(uri);
}