private Observable<ChangeNotification<InstanceInfo>> buildEurekaFullRegistryObservable() { return interestClient.forInterest(Interests.forFullRegistry()); }
@Override protected void subscribeToInterest(Session activeSession, String[] args) { activeSession.forInterest(Interests.forFullRegistry()); } };
@Override protected void subscribeToInterest(Session activeSession, String[] args) { activeSession.forInterest(Interests.forFullRegistry()); } };
private Observable<ChangeNotification<InstanceInfo>> buildEurekaFullRegistryObservable() { return eurekaClient.forInterest(Interests.forFullRegistry()); }
public void batchEnd() { batchEnd(Interests.forFullRegistry()); }
public void batchStart() { batchStart(Interests.forFullRegistry()); }
private Observable<RegistryFetch> getLatestFullFetch() { if (fullFetchWithDeltaView.get() == null) { synchronized (fullFetchWithDeltaView) { if (fullFetchWithDeltaView.get() == null) { Eureka2FullFetchWithDeltaView newView = new Eureka2FullFetchWithDeltaView( registry.forInterest(Interests.forFullRegistry()), refreshIntervalMs, scheduler ); fullFetchWithDeltaView.set(newView); } } } return fullFetchWithDeltaView.get().latestCopy(); }
@Override public Observable<Void> call(final ReplicationChannel channel) { return registry.forInterest(Interests.forFullRegistry(), Source.matcherFor(Source.Origin.LOCAL)) .flatMap(new Func1<ChangeNotification<InstanceInfo>, Observable<Void>>() {// TODO concatMap once backpressure is properly working @Override public Observable<Void> call(ChangeNotification<InstanceInfo> notification) { switch (notification.getKind()) { case Add: return channel.register(notification.getData()); case Modify: return channel.register(notification.getData()); case Delete: return channel.unregister(notification.getData().getId()); default: logger.warn("Unrecognised notification kind {}", notification); return Observable.empty(); } } }); } }
@PostConstruct public void start() { eurekaClient = eureka2InterestClientProvider.get(); eurekaClient.forInterest(Interests.forFullRegistry()).retry().subscribe(new Action1<ChangeNotification<InstanceInfo>>() { @Override public void call(ChangeNotification<InstanceInfo> changeNotification) { final ChangeNotification.Kind notificationKind = changeNotification.getKind(); final InstanceInfo instInfo = changeNotification.getData(); if (notificationKind == ChangeNotification.Kind.Add || notificationKind == ChangeNotification.Kind.Modify) { registryCache.put(instInfo.getId(), instInfo); } else if (notificationKind == ChangeNotification.Kind.Delete) { registryCache.remove(instInfo.getId()); } } }); } }
@Override public void call() { logger.info("Starting new round of replication from v1 to v2"); registry.forSnapshot(Interests.forFullRegistry(), Source.localSource()) .filter(new Func1<InstanceInfo, Boolean>() { // filter self so it's not take into account @Override
@PostConstruct public void startRegistryAuditing() { InstanceInfo auditServer = serverIdentity.resolve().toBlocking().firstOrDefault(null); final String auditServerId = auditServer == null ? null : auditServer.getId(); // TODO: this should be only Origin.Local, but since bridge works on replication channel we would not audit eureka 1.0 entries. registry.forInterest(Interests.forFullRegistry()).subscribe(new Subscriber<ChangeNotification<InstanceInfo>>() { @Override public void onCompleted() { logger.warn("Registry auditing finished"); } @Override public void onError(Throwable e) { logger.warn("Registry auditing finished due to an error in interest channel subscription", e); } @Override public void onNext(ChangeNotification<InstanceInfo> notification) { AuditRecord record = AuditRecords.forChangeNotification(auditServerId, System.currentTimeMillis(), false, notification); auditService.write(record); } }); } }
private void loadUpdatesFromV1Registry() { logger.info("Starting new round of replication from v1 to v2"); registry.forSnapshot(Interests.forFullRegistry(), Source.matcherFor(Source.Origin.LOCAL)) .filter(new Func1<InstanceInfo, Boolean>() { // filter self so it's not take into account @Override public Boolean call(InstanceInfo instanceInfo) { return !instanceInfo.getId().equals(self.getId()); } }) .toMap(new Func1<InstanceInfo, String>() { @Override public String call(InstanceInfo instanceInfo) { return instanceInfo.getId(); } }) .subscribe(new Subscriber<Map<String, InstanceInfo>>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { logger.warn("Error generating snapshot of registry", e); } @Override public void onNext(Map<String, InstanceInfo> currentSnapshot) { diff(currentSnapshot); } }); }
final Observable<ChangeNotification<InstanceInfo>> notificationsObservable = eurekaClient.forInterest(Interests.forFullRegistry());
interestClient.forInterest(Interests.forFullRegistry());
private Observable<Void> loadRegistryFromServer(final Server server, final SourcedEurekaRegistry<InstanceInfo> registry, final Source source) { logger.info("Bootstrapping registry from server {}...", server); return createLightEurekaInterestClient(server).forInterest(Interests.forFullRegistry()) .flatMap(new Func1<ChangeNotification<InstanceInfo>, Observable<Integer>>() { @Override