use of com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider in project spring-cloud-netflix by spring-cloud.
the class RestTemplateEurekaHttpClientTest method setup.
@Before
public void setup() {
eurekaHttpClient = new RestTemplateTransportClientFactory().newClient(new DefaultEndpoint(serviceUrl));
EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils);
String appname = "customapp";
config.setIpAddress("127.0.0.1");
config.setHostname("localhost");
config.setAppname(appname);
config.setVirtualHostName(appname);
config.setSecureVirtualHostName(appname);
config.setNonSecurePort(4444);
config.setSecurePort(8443);
config.setInstanceId("127.0.0.1:customapp:4444");
info = new EurekaConfigBasedInstanceInfoProvider(config).get();
}
use of com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider in project hazelcast-eureka by hazelcast.
the class EurekaOneDiscoveryStrategy method initializeApplicationInfoManager.
private ApplicationInfoManager initializeApplicationInfoManager(DiscoveryNode localNode) {
EurekaInstanceConfig instanceConfig = buildInstanceConfig(localNode);
InstanceInfo instanceInfo = new EurekaConfigBasedInstanceInfoProvider(instanceConfig).get();
ApplicationInfoManager manager = new ApplicationInfoManager(instanceConfig, instanceInfo);
statusChangeStrategy.update(manager, InstanceInfo.InstanceStatus.STARTING);
return manager;
}
use of com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider in project eureka by Netflix.
the class ExampleEurekaService method initializeApplicationInfoManager.
private static synchronized ApplicationInfoManager initializeApplicationInfoManager(EurekaInstanceConfig instanceConfig) {
if (applicationInfoManager == null) {
InstanceInfo instanceInfo = new EurekaConfigBasedInstanceInfoProvider(instanceConfig).get();
applicationInfoManager = new ApplicationInfoManager(instanceConfig, instanceInfo);
}
return applicationInfoManager;
}
use of com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider in project eureka by Netflix.
the class EurekaBootStrap method initEurekaServerContext.
/**
* init hook for server context. Override for custom logic.
*/
protected void initEurekaServerContext() throws Exception {
EurekaServerConfig eurekaServerConfig = new DefaultEurekaServerConfig();
// For backward compatibility
JsonXStream.getInstance().registerConverter(new V1AwareInstanceInfoConverter(), XStream.PRIORITY_VERY_HIGH);
XmlXStream.getInstance().registerConverter(new V1AwareInstanceInfoConverter(), XStream.PRIORITY_VERY_HIGH);
logger.info("Initializing the eureka client...");
logger.info(eurekaServerConfig.getJsonCodecName());
ServerCodecs serverCodecs = new DefaultServerCodecs(eurekaServerConfig);
ApplicationInfoManager applicationInfoManager = null;
if (eurekaClient == null) {
EurekaInstanceConfig instanceConfig = isCloud(ConfigurationManager.getDeploymentContext()) ? new CloudInstanceConfig() : new MyDataCenterInstanceConfig();
applicationInfoManager = new ApplicationInfoManager(instanceConfig, new EurekaConfigBasedInstanceInfoProvider(instanceConfig).get());
EurekaClientConfig eurekaClientConfig = new DefaultEurekaClientConfig();
eurekaClient = new DiscoveryClient(applicationInfoManager, eurekaClientConfig);
} else {
applicationInfoManager = eurekaClient.getApplicationInfoManager();
}
PeerAwareInstanceRegistry registry;
if (isAws(applicationInfoManager.getInfo())) {
registry = new AwsInstanceRegistry(eurekaServerConfig, eurekaClient.getEurekaClientConfig(), serverCodecs, eurekaClient);
awsBinder = new AwsBinderDelegate(eurekaServerConfig, eurekaClient.getEurekaClientConfig(), registry, applicationInfoManager);
awsBinder.start();
} else {
registry = new PeerAwareInstanceRegistryImpl(eurekaServerConfig, eurekaClient.getEurekaClientConfig(), serverCodecs, eurekaClient);
}
PeerEurekaNodes peerEurekaNodes = getPeerEurekaNodes(registry, eurekaServerConfig, eurekaClient.getEurekaClientConfig(), serverCodecs, applicationInfoManager);
serverContext = new DefaultEurekaServerContext(eurekaServerConfig, serverCodecs, registry, peerEurekaNodes, applicationInfoManager);
EurekaServerContextHolder.initialize(serverContext);
serverContext.initialize();
logger.info("Initialized server context");
// Copy registry from neighboring eureka node
int registryCount = registry.syncUp();
registry.openForTraffic(applicationInfoManager, registryCount);
// Register all monitoring statistics.
EurekaMonitors.registerAllStats();
}
use of com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider in project nutzboot by nutzam.
the class EurekaClientStarter method getApplicationInfoManager.
@IocBean(name = "applicationInfoManager")
public ApplicationInfoManager getApplicationInfoManager(EurekaInstanceConfig eurekaInstanceConfig) {
InstanceInfo instanceInfo = new EurekaConfigBasedInstanceInfoProvider(eurekaInstanceConfig).get();
ApplicationInfoManager applicationInfoManager = new ApplicationInfoManager(eurekaInstanceConfig, instanceInfo);
applicationInfoManager.setInstanceStatus(InstanceInfo.InstanceStatus.STARTING);
return applicationInfoManager;
}
Aggregations