@Override public List<Server> getUpdatedListOfServers() { String tag = ( this.isSecure ? "https" : "http" ); return TopologyManager.INSTANCE.registrationsForService(this.appName, tag) .stream() .map( reg-> new Server( reg.getAddress(), reg.getPort() )) .collect(Collectors.toList()); } }
@Override public List<Server> getInitialListOfServers() { String tag = ( this.isSecure ? "https" : "http" ); return TopologyManager.INSTANCE.registrationsForService(this.appName, tag) .stream() .map( reg-> new Server( reg.getAddress(), reg.getPort() )) .collect(Collectors.toList()); }
@Override public List<Server> getInitialListOfServers() { String tag = (this.isSecure ? "https" : "http"); return TopologyManager.INSTANCE.registrationsForService(this.appName, tag) .stream() .map(reg -> new Server(reg.getAddress(), reg.getPort())) .collect(Collectors.toList()); }
@Override public List<Server> getUpdatedListOfServers() { String tag = (this.isSecure ? "https" : "http"); return TopologyManager.INSTANCE.registrationsForService(this.appName, tag) .stream() .map(reg -> new Server(reg.getAddress(), reg.getPort())) .collect(Collectors.toList()); }
@Override public List<Server> getInitialListOfServers() { String tag = (this.isSecure ? "https" : "http"); return TopologyManager.INSTANCE.registrationsForService(this.appName, tag) .stream() .map(reg -> new Server(reg.getAddress(), reg.getPort())) .collect(Collectors.toList()); }
@Override public List<Server> getUpdatedListOfServers() { String tag = (this.isSecure ? "https" : "http"); return TopologyManager.INSTANCE.registrationsForService(this.appName, tag) .stream() .map(reg -> new Server(reg.getAddress(), reg.getPort())) .collect(Collectors.toList()); }
@Override public void notify(Map<HostAndPort, ServiceHealth> newValues) { Set<Registration> previousEntries = topologyManager.registrationsForService(this.name); Set<Registration> newEntries = newValues.values().stream() .map(e -> new Registration("consul", this.name, e.getService().getAddress(), e.getService().getPort()) .addTags(e.getService().getTags()) ) .collect(Collectors.toSet()); previousEntries.stream() .filter(e -> !newEntries.contains(e)) .forEach(e -> { this.topologyManager.unregister(e); }); newEntries.stream() .filter(e -> !previousEntries.contains(e)) .forEach(e -> { this.topologyManager.register(e); }); } }