@Override protected void subscribeToInterest(Session activeSession, String[] args) { activeSession.forInterest(Interests.forFullRegistry()); } };
public static Interest<InstanceInfo> forApplications(String... applicationNames) { return forApplications(Operator.Equals, applicationNames); }
public static Interest<InstanceInfo> forVips(String... vips) { return forVips(Operator.Equals, vips); }
public Interest<InstanceInfo> allApplicationsInterest() { List<Interest<InstanceInfo>> interests = new ArrayList<>(); for (Application application : applications) { interests.add(Interests.forApplications(application.getName())); } return Interests.forSome(interests.toArray(new Interest[interests.size()])); }
fromEureka( fromDnsName(writeServerDns).withPort(writeInterestPort) ).forInterest(forVips(readServerVip)); .build(); interestClient.forInterest(forApplications("WriteServer", "ReadServer", "ServiceA")).subscribe( new Subscriber<ChangeNotification<InstanceInfo>>() { @Override
public Interest<InstanceInfo> toComposite() { if(interests.length == 0) { return Interests.forNone(); } if (interests.length > 1) { return new MultipleInterests<InstanceInfo>(interests); } return interests[0]; }
@Override public Interest<InstanceInfo> build() { return Interests.forSome(ZuulApp.build(), DiscoveryApp.build()); } };
public static Interest<InstanceInfo> forInstances(String... instanceIds) { return forInstance(Operator.Equals, instanceIds); }
@Override public Interest<InstanceInfo> next() { DependencyProfile dependencyProfile = dependencyProfileIt.next(); Map<ApplicationProfile, Integer> subscriptionMap = dependencyProfile.getSubscriptionsPerProfile(); List<Interest<InstanceInfo>> interests = new ArrayList<>(); for (Map.Entry<ApplicationProfile, Integer> entry : subscriptionMap.entrySet()) { List<Application> byProfile = applicationsByProfile.get(entry.getKey()); List<Application> selection = randomSubset(byProfile, entry.getValue()); for (Application selected : selection) { interests.add(Interests.forApplications(selected.getName())); } } return Interests.forSome(interests.toArray(new Interest[interests.size()])); }
@Override public void onCompleted() { sendOnCompleteOnTransport(); // On complete of stream. change(Interests.forNone()); // TODO: needed? }
@Override public Interest<InstanceInfo> build() { return Interests.forSome(ZuulInstance.build(), DiscoveryApp.build(), ZuulVipSecure.build(), DiscoveryInstance.build()); } };
public Observable<com.netflix.appinfo.InstanceInfo> findInstance(String instanceId) { return registry.forInterest(Interests.forInstance(Operator.Equals, instanceId)) .compose(ChangeNotifications.<InstanceInfo>delineatedBuffers()) .compose(ChangeNotifications.<InstanceInfo>snapshots()) .flatMap(new Func1<LinkedHashSet<InstanceInfo>, Observable<com.netflix.appinfo.InstanceInfo>>() { @Override public Observable<com.netflix.appinfo.InstanceInfo> call(LinkedHashSet<InstanceInfo> latestSnapshot) { if (latestSnapshot.isEmpty()) { return Observable.empty(); } InstanceInfo instanceInfo = latestSnapshot.iterator().next(); if (latestSnapshot.size() > 1) { logger.error("Data consistency issue; two instances found with the same instance id {}", instanceInfo.getId()); } return Observable.just(toEureka1xInstanceInfo(latestSnapshot.iterator().next())); } }); }
@Override protected void subscribeToInterest(Session activeSession, String[] args) { activeSession.forInterest(Interests.forFullRegistry()); } };
@Override protected void subscribeToInterest(Session activeSession, String[] args) { activeSession.forInterest(Interests.forVips(Operator.Like, args)); } };
@Override protected void subscribeToInterest(Session activeSession, String[] args) { activeSession.forInterest(Interests.forApplications(Operator.Like, args)); } };
@Override public void _close() { if (state.compareAndSet(STATES.Open, STATES.Closed)) { state.set(STATES.Closed); channelSubscriptionMonitor.update(Interests.forNone()); metrics.stateTransition(STATES.Open, STATES.Closed); notificationMultiplexer.unregister(); super._close(); // Shutdown the transport } } }
public void batchEnd() { batchEnd(Interests.forFullRegistry()); }
@Override protected void subscribeToInterest(Session activeSession, String[] args) { activeSession.forInterest(Interests.forVips(Operator.Like, args)); } };
@Override public Observable<ChangeNotification<InstanceInfo>> forApplication(String appName) { return forInterest(Interests.forApplications(appName)); }
@Override public void _close() { if (moveToState(STATE.Open, STATE.Closed)) { channelSubscriptionMonitor.update(Interests.forNone()); notificationMultiplexer.unregister(); super._close(); // Shutdown the transport } } }