Java Code Examples for org.springframework.cloud.netflix.eureka.server.event.EurekaInstanceRegisteredEvent#getInstanceInfo()
The following examples show how to use
org.springframework.cloud.netflix.eureka.server.event.EurekaInstanceRegisteredEvent#getInstanceInfo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EurekaInstanceRegisteredListener.java From api-layer with Eclipse Public License 2.0 | 6 votes |
/** * Translates service instance Eureka metadata from older versions to the current version */ @EventListener public void listen(EurekaInstanceRegisteredEvent event) { final InstanceInfo instanceInfo = event.getInstanceInfo(); final Map<String, String> metadata = instanceInfo.getMetadata(); final String serviceId = EurekaUtils.getServiceIdFromInstanceId(instanceInfo.getInstanceId()); metadataTranslationService.translateMetadata(serviceId, metadata); metadataDefaultsService.updateMetadata(serviceId, metadata); if (StringUtils.equalsIgnoreCase(GatewayNotifier.GATEWAY_SERVICE_ID, serviceId)) { /** * meanwhile gateway was down, another Gateway could receive logout, those invalidated credentials should * be distributed to this new Gateway */ gatewayNotifier.distributeInvalidatedCredentials(instanceInfo.getInstanceId()); } // ie. new instance can have different authentication (than other one), this is reason to evict caches on gateway gatewayNotifier.serviceUpdated(serviceId, instanceInfo.getInstanceId()); }
Example 2
Source File: EurekaInstanceListener.java From spring-cloud-gray with Apache License 2.0 | 5 votes |
/** * 监听eureka实例注册事件,并发送信息给灰度服务器 * * @param event eureka 实例注册事件 */ @EventListener public void listenRegistered(EurekaInstanceRegisteredEvent event) { com.netflix.appinfo.InstanceInfo instanceInfo = event.getInstanceInfo(); InstanceStatus instanceStatus = EurekaInstatnceTransformer.toGrayInstanceStatus(instanceInfo.getStatus()); sendNotice(instanceInfo, instanceStatus, "REGISTERED"); }
Example 3
Source File: GemFrameEurekaListener.java From gem with MIT License | 4 votes |
@EventListener //服务注册事件 public void listen(EurekaInstanceRegisteredEvent event) { InstanceInfo instanceInfo = event.getInstanceInfo(); System.out.println("服务注册事件:"+instanceInfo.getAppName()+":"+instanceInfo.getIPAddr()+":"+instanceInfo.getPort()); }