@Override protected void before() throws Throwable { interestClient = Eurekas.newInterestClientBuilder().withServerResolver(serverResolver).build(); }
@Override public EurekaInterestClient get() { if (interestClient == null) { interestClient = Eurekas.newInterestClientBuilder() .withServerResolver(getInterestResolver()) .build(); } return interestClient; } });
@Override public EurekaInterestClient get() { logger.info("Subscribing to Eureka2 server {}:{}", discoveryDNS, port); return Eurekas.newInterestClientBuilder() .withServerResolver(ServerResolvers.fromDnsName(discoveryDNS).withPort(port)) .build(); } }
/** * Create a {@link EurekaInterestClient} instance to do interest discovery with any instance in a write cluster */ public EurekaInterestClient interestClientToWriteCluster() { EurekaInterestClient interestClient = Eurekas.newInterestClientBuilder() .withTransportConfig(transportConfig) .withServerResolver(getWriteCluster().interestResolver()) .build(); connectedInterestClients.add(interestClient); return interestClient; }
/** * Create a {@link EurekaInterestClient} instance to do interest discovery with any instance in a read cluster */ public EurekaInterestClient interestClientToReadCluster() { EurekaInterestClient interestClient = Eurekas.newInterestClientBuilder() .withTransportConfig(transportConfig) .withServerResolver(getReadCluster().interestResolver()) .build(); connectedInterestClients.add(interestClient); return interestClient; }
public static void main(String[] args) { final EurekaInterestClient interestClient = Eurekas.newInterestClientBuilder() .withServerResolver(ServerResolvers.fromHostname("localhost").withPort(13101)) .build();
/** * Create a {@link EurekaInterestClient} instance to do interest discovery with a particular read server * * @param idx id of a write server where to connect */ public EurekaInterestClient interestClientToReadServer(int idx) { EmbeddedReadServer server = getReadCluster().getServer(idx); EurekaInterestClient interestClient = Eurekas.newInterestClientBuilder() .withTransportConfig(transportConfig) .withServerResolver(server.getInterestResolver()) .build(); connectedInterestClients.add(interestClient); return interestClient; }
/** * Create a {@link EurekaInterestClient} instance to do interest discovery with a particular write server * * @param idx id of a write server where to connect */ public EurekaInterestClient interestClientToWriteServer(int idx) { EmbeddedWriteServer server = getWriteCluster().getServer(idx); EurekaInterestClient interestClient = Eurekas.newInterestClientBuilder() .withTransportConfig(transportConfig) .withServerResolver(server.getInterestResolver()) .build(); connectedInterestClients.add(interestClient); return interestClient; }
public void connectToRead(String host, int port) { interestClient = Eurekas.newInterestClientBuilder() .withTransportConfig(context.getTransportConfig()) .withServerResolver(ServerResolvers.fromHostname(host).withPort(port)) .build(); mode = Mode.Read; }
/** * Create a {@link EurekaInterestClient} instance to do interest discovery with any instance in a read cluster, * using the canonical method to first discover the read cluster from the write cluster */ public EurekaInterestClient cannonicalInterestClient() { EurekaInterestClient interestClient = Eurekas.newInterestClientBuilder() .withTransportConfig(transportConfig) .withServerResolver(ServerResolvers.fromEureka(getWriteCluster().interestResolver()) .forInterest(forVips(getReadCluster().getVip()))) .build(); connectedInterestClients.add(interestClient); return interestClient; }
).forInterest(forVips(readServerVip)); EurekaInterestClient interestClient = Eurekas.newInterestClientBuilder() .withServerResolver(interestClientResolver) .build();
@Override public void start() { final EurekaRegistrationClient registrationClient = Eurekas.newRegistrationClientBuilder() .withTransportConfig(config) .withRegistryConfig(config) .withServerResolver(registrationServerResolver) .build(); final EurekaInterestClient interestClient = Eurekas.newInterestClientBuilder() .withTransportConfig(config) .withRegistryConfig(config) .withServerResolver(interestServerResolver) .build(); Module[] modules = {new EurekaDashboardModule(config, registrationClient, interestClient)}; setup(modules); }
public void connectToCluster(String host, int registrationPort, int interestPort, String readClusterVip) { registrationClient = Eurekas.newRegistrationClientBuilder() .withTransportConfig(context.getTransportConfig()) .withServerResolver(ServerResolvers.fromHostname(host).withPort(registrationPort)) .build(); interestClient = Eurekas.newInterestClientBuilder() .withTransportConfig(context.getTransportConfig()) .withServerResolver(ServerResolvers.fromEureka( ServerResolvers.fromDnsName(host).withPort(interestPort)) .forInterest(Interests.forVips(readClusterVip)) ) .build(); mode = Mode.ReadWrite; }