@ApolloConfigChangeListener interestedKeyPrefixes When can dynamic parameterization be supported

xv8emn3q  于 4个月前  发布在  其他
关注(0)|答案(4)|浏览(89)

I hope the @ ApolloConfigChangeListener interestedKeyPrefixes can support dynamic parameters。I would like to know whether it is not supported now or there is a problem with the use;

@Value("${my.prefix}")
private String myPrefix;

@Autowired
private ConfigurableApplicationContext context;

@ApolloConfigChangeListener(value = {"${apollo.bootstrap.namespaces}"}, interestedKeyPrefixes = "#{myPrefix}")
private void onChange(ConfigChangeEvent changeEvent) {
    //handle change event
    if (!changeEvent.changedKeys().isEmpty()) {
        context.publishEvent(new RefreshEvent(this, changeEvent, "Apollo Refresh"));
    }
}

If not now, when will it be?

ndasle7k

ndasle7k1#

I believe the dynamic value is supported with pr #3349 , but I'm not sure whether interestedKeyPrefixes is supported cc @Anilople

9wbgstp7

9wbgstp72#

I believe the dynamic value is supported with pr #3349 , but I'm not sure whether interestedKeyPrefixes is supported cc @Anilople

According https://github.com/apolloconfig/apollo/pull/3349/files#diff-c24a6923b6a3196c6148e0d2e9a8b7784ff71d30b91550dae96dad798c03014cR121

final String resolvedNamespace = this.environment.resolveRequiredPlaceholders(namespace);
      Config config = ConfigService.getConfig(resolvedNamespace);

interestedKeyPrefixes in annotation @ApolloConfigChangeListener didn't resolve yet.

olhwl3o2

olhwl3o23#

🔔 Is anyone working on this? I'll implement dynamic parameterization when I have some free time.

gcxthw6b

gcxthw6b4#

@huxleyliau That sounds great! I just assigned this issue to you.

相关问题