org.springframework.cloud.netflix.zuul.RoutesRefreshedEvent Java Examples
The following examples show how to use
org.springframework.cloud.netflix.zuul.RoutesRefreshedEvent.
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: NacosDynRouteLocator.java From microservices-platform with Apache License 2.0 | 6 votes |
/** * 添加Nacos监听 */ private void addListener() { try { nacosConfigProperties.configServiceInstance().addListener(ZUUL_DATA_ID, ZUUL_GROUP_ID, new Listener() { @Override public Executor getExecutor() { return null; } @Override public void receiveConfigInfo(String configInfo) { //赋值路由信息 locator.setZuulRouteEntities(getListByStr(configInfo)); RoutesRefreshedEvent routesRefreshedEvent = new RoutesRefreshedEvent(locator); publisher.publishEvent(routesRefreshedEvent); } }); } catch (NacosException e) { log.error("nacos-addListener-error", e); } }
Example #2
Source File: ZuulPropertiesRefresher.java From apollo-use-cases with Apache License 2.0 | 6 votes |
private void refreshZuulProperties(ConfigChangeEvent changeEvent) { logger.info("Refreshing zuul properties!"); /** * rebind configuration beans, e.g. ZuulProperties * @see org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder#onApplicationEvent */ this.applicationContext.publishEvent(new EnvironmentChangeEvent(changeEvent.changedKeys())); /** * refresh routes * @see org.springframework.cloud.netflix.zuul.ZuulServerAutoConfiguration.ZuulRefreshListener#onApplicationEvent */ this.applicationContext.publishEvent(new RoutesRefreshedEvent(routeLocator)); logger.info("Zuul properties refreshed!"); }
Example #3
Source File: ZuulPropertiesRefresher.java From mini-platform with MIT License | 6 votes |
private void refreshZuulProperties(ConfigChangeEvent changeEvent) { logger.info("Refreshing zuul properties!"); /** * rebind configuration beans, e.g. ZuulProperties * @see org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder#onApplicationEvent */ this.applicationContext.publishEvent(new EnvironmentChangeEvent(changeEvent.changedKeys())); /** * refresh routes * @see org.springframework.cloud.netflix.zuul.ZuulServerAutoConfiguration.ZuulRefreshListener#onApplicationEvent */ this.applicationContext.publishEvent(new RoutesRefreshedEvent(routeLocator)); logger.info("Zuul properties refreshed!"); }
Example #4
Source File: JdbcRouteLocator.java From open-cloud with MIT License | 4 votes |
@Override public void doRefresh() { super.doRefresh(); // 发布本地刷新事件, 更新相关本地缓存, 解决动态加载完,新路由映射无效的问题 publisher.publishEvent(new RoutesRefreshedEvent(this)); }