com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener Java Examples

The following examples show how to use com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener. 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: ApolloConfig.java    From java-tutorial with MIT License 5 votes vote down vote up
@ApolloConfigChangeListener(ConfigConsts.NAMESPACE_APPLICATION)
public void onChange(ConfigChangeEvent changeEvent) {
    logger.info("before refresh");
    for (String changedKey : changeEvent.changedKeys()) {
        logger.info("===============================================================");
        logger.info("changedKey:{} value:{}", changedKey, changeEvent.getChange(changedKey));
        ConfigChange configChange = changeEvent.getChange(changedKey);
        configChange.getOldValue();
    }
    refreshScope.refreshAll();
    logger.info("after refresh");
}
 
Example #2
Source File: SpringBootApolloRefreshConfig.java    From apollo with Apache License 2.0 5 votes vote down vote up
@ApolloConfigChangeListener(value = {ConfigConsts.NAMESPACE_APPLICATION, "TEST1.apollo", "application.yaml"},
    interestedKeyPrefixes = {"redis.cache."})
public void onChange(ConfigChangeEvent changeEvent) {
  logger.info("before refresh {}", sampleRedisConfig.toString());
  refreshScope.refresh("sampleRedisConfig");
  logger.info("after refresh {}", sampleRedisConfig.toString());
}
 
Example #3
Source File: ZuulPropertiesRefresher.java    From mini-platform with MIT License 5 votes vote down vote up
@ApolloConfigChangeListener
    public void onChange(ConfigChangeEvent changeEvent) {
        refreshZuulProperties(changeEvent);
//        boolean zuulPropertiesChanged = false;
//        for (String changedKey : changeEvent.changedKeys()) {
//            if (changedKey.startsWith("zuul.")||changedKey.startsWith("link.") || changedKey.contains(".ribbon.listOfServers")) {
//                zuulPropertiesChanged = true;
//                break;
//            }
//        }
//
//        if (zuulPropertiesChanged) {
//            refreshZuulProperties(changeEvent);
//        }
    }
 
Example #4
Source File: ZuulRateLimitPropertiesRefreshConfig.java    From apollo-use-cases with Apache License 2.0 5 votes vote down vote up
@ApolloConfigChangeListener(interestedKeyPrefixes = PREFIX)
public void onChange(ConfigChangeEvent changeEvent) {
  logger.info("Refreshing Zuul rateLimit Properties");

  this.applicationContext.publishEvent(new EnvironmentChangeEvent(changeEvent.changedKeys()));

  logger.info("Zuul rateLimit Properties refreshed!");
}
 
Example #5
Source File: XMLConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(value = {ConfigConsts.NAMESPACE_APPLICATION, FX_APOLLO_NAMESPACE},
    interestedKeys = {"anotherKey"})
private void anotherOnChange(ConfigChangeEvent changeEvent) {

}
 
Example #6
Source File: ApolloRefreshConfig.java    From dk-foundation with GNU Lesser General Public License v2.1 4 votes vote down vote up
@ApolloConfigChangeListener

    private void onChange(ConfigChangeEvent changeEvent) {
        refreshScope.refreshAll();
    }
 
Example #7
Source File: ApolloMockServerSpringIntegrationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(value = otherNamespace, interestedKeyPrefixes = "server.")
private void onChange(ConfigChangeEvent changeEvent) {
  futureData.set(changeEvent);
}
 
Example #8
Source File: ApolloMockServerSpringIntegrationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(otherNamespace)
private void onChange(ConfigChangeEvent changeEvent) {
  futureData.set(changeEvent);
}
 
Example #9
Source File: JavaConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(APPLICATION_YAML_NAMESPACE)
private void onChange(ConfigChangeEvent event) {
  configChangeEventFuture.set(event);
}
 
Example #10
Source File: JavaConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(value = {ConfigConsts.NAMESPACE_APPLICATION, FX_APOLLO_NAMESPACE},
    interestedKeys = {"anotherKey"})
private void anotherOnChange(ConfigChangeEvent changeEvent) {

}
 
Example #11
Source File: JavaConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(interestedKeys = {"someKey"})
private void someOnChange(ConfigChangeEvent changeEvent) {}
 
Example #12
Source File: JavaConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener
private void someOnChange(ConfigChangeEvent changeEvent) {
  this.someChangeEvent = changeEvent;
}
 
Example #13
Source File: JavaConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener({ConfigConsts.NAMESPACE_APPLICATION, FX_APOLLO_NAMESPACE})
private void onChange3(ConfigChangeEvent changeEvent) {
  this.changeEvent3 = changeEvent;
}
 
Example #14
Source File: JavaConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(ConfigConsts.NAMESPACE_APPLICATION)
private void onChange2(ConfigChangeEvent changeEvent) {
  this.changeEvent2 = changeEvent;
}
 
Example #15
Source File: JavaConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener
private void onChange1(ConfigChangeEvent changeEvent) {
  this.changeEvent1 = changeEvent;
}
 
Example #16
Source File: XMLConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(interestedKeys = {"someKey"})
private void someOnChange(ConfigChangeEvent changeEvent) {}
 
Example #17
Source File: XMLConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener({ConfigConsts.NAMESPACE_APPLICATION, FX_APOLLO_NAMESPACE})
private void onChange3(ConfigChangeEvent changeEvent) {
  this.changeEvent3 = changeEvent;
}
 
Example #18
Source File: XMLConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(ConfigConsts.NAMESPACE_APPLICATION)
private void onChange2(ConfigChangeEvent changeEvent) {
  this.changeEvent2 = changeEvent;
}
 
Example #19
Source File: XMLConfigAnnotationTest.java    From apollo with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener
private void onChange1(ConfigChangeEvent changeEvent) {
  this.changeEvent1 = changeEvent;
}
 
Example #20
Source File: LoggerLevelRefresher.java    From apollo-use-cases with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(interestedKeyPrefixes = {"logging.level."})
private void onChange(ConfigChangeEvent changeEvent) {
  refreshLoggingLevels(changeEvent.changedKeys());
}
 
Example #21
Source File: ZuulPropertiesRefresher.java    From apollo-use-cases with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(interestedKeyPrefixes = "zuul.")
public void onChange(ConfigChangeEvent changeEvent) {
  refreshZuulProperties(changeEvent);
}
 
Example #22
Source File: GatewayPropertiesRefresher.java    From apollo-use-cases with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(interestedKeyPrefixes = "spring.cloud.gateway.")
public void onChange(ConfigChangeEvent changeEvent) {
    refreshGatewayProperties(changeEvent);
}
 
Example #23
Source File: DataSourceRefresher.java    From apollo-use-cases with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener(interestedKeyPrefixes = "spring.datasource.")
public void onChange(ConfigChangeEvent changeEvent) {
  refreshDataSource(changeEvent.changedKeys());
}
 
Example #24
Source File: LoggerConfiguration.java    From apollo-use-cases with Apache License 2.0 4 votes vote down vote up
@ApolloConfigChangeListener
private void onChange(ConfigChangeEvent changeEvent) {
  refreshLoggingLevels();
}
 
Example #25
Source File: XMLConfigAnnotationTest.java    From apollo with Apache License 2.0 2 votes vote down vote up
@ApolloConfigChangeListener
private void onChange(ConfigChangeEvent event, String someParam) {

}
 
Example #26
Source File: XMLConfigAnnotationTest.java    From apollo with Apache License 2.0 2 votes vote down vote up
@ApolloConfigChangeListener
private void onChange(String event) {

}
 
Example #27
Source File: JavaConfigAnnotationTest.java    From apollo with Apache License 2.0 2 votes vote down vote up
@ApolloConfigChangeListener
private void onChange(String event) {

}
 
Example #28
Source File: JavaConfigAnnotationTest.java    From apollo with Apache License 2.0 2 votes vote down vote up
@ApolloConfigChangeListener
private void onChange(ConfigChangeEvent event, String someParam) {

}