Class AppConfigurationRefresh

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.ApplicationEventPublisherAware

    @Component
    public class AppConfigurationRefresh
    extends Object
    implements org.springframework.context.ApplicationEventPublisherAware
    Enables checking of Configuration updates.
    • Constructor Detail

      • AppConfigurationRefresh

        public AppConfigurationRefresh​(AppConfigurationProperties properties,
                                       AppConfigurationProviderProperties appProperties,
                                       ClientStore clientStore)
        Component used for checking for and triggering configuration refreshes.
        Parameters:
        properties - Client properties to check against.
        appProperties - Library properties for configuring backoff
        clientStore - Clients stores used to connect to App Configuration.
    • Method Detail

      • setApplicationEventPublisher

        public void setApplicationEventPublisher​(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
        Specified by:
        setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
      • refreshConfigurations

        @Async
        public Future<Boolean> refreshConfigurations()
        Checks configurations to see if configurations should be reloaded. If the refresh interval has passed and a trigger has been updated configuration are reloaded.
        Returns:
        Future with a boolean of if a RefreshEvent was published. If refreshConfigurations is currently being run elsewhere this method will return right away as false.
      • expireRefreshInterval

        public void expireRefreshInterval​(String endpoint,
                                          String syncToken)
        Soft expires refresh interval. Sets amount of time to next refresh to be a random value between 0 and 15 seconds, unless value is less than the amount of time to the next refresh check.
        Parameters:
        endpoint - Config Store endpoint to expire refresh interval on.
        syncToken - syncToken to verify latest changes are available on pull
      • getAppConfigurationStoresHealth

        public Map<String,​AppConfigurationStoreHealth> getAppConfigurationStoresHealth()
        Gets latest Health connection info for refresh.
        Returns:
        Map of String, endpoint, and Health information.