Java Spring应用推送刷新动态配置:能否省略推送通知属性?
关于Azure App Configuration推送刷新配置的疑问解答
可以不配置push-notification相关属性,具体差异和配置方式如下:
不配置推送通知的情况
此时应用会采用轮询模式检测配置变更:依靠你设置的refresh-interval(示例中是30天)定期去Azure App Configuration拉取配置,检查是否有更新。这种模式完全不需要推送令牌,适合对配置更新延迟要求不高的场景,缺点是配置变更后,应用要等到下一次轮询周期才会感知并刷新配置。配置推送通知的作用
推送模式是让Azure主动向应用发送配置变更通知,应用能立即感知到变化并刷新,不需要等待轮询间隔,适合对配置更新实时性要求高的场景。如果要启用这种模式,才需要配置push-notification的令牌属性——这些令牌需要在Azure门户的对应App Configuration资源中生成(在"推送通知"管理页面创建访问令牌即可获取name和secret)。
调整后的无推送通知配置示例:
# Azure App Configuration Properties spring.cloud.azure.appconfiguration.stores[0].connection-string= ${AppConfigurationConnectionString} spring.cloud.azure.appconfiguration.stores[0].monitoring.enabled= true spring.cloud.azure.appconfiguration.stores[0].monitoring.refresh-interval= 30d spring.cloud.azure.appconfiguration.stores[0].monitoring.triggers[0].key= sentinel management.endpoints.web.exposure.include= appconfiguration-refresh
内容的提问来源于stack exchange,提问作者Evgen Kr
相关产品推荐
相关产品推荐

