Bus 端点
Spring Cloud Bus 提供了三个端点,/actuator/busrefresh
、/actutator/busshutdown
和 /actuator/busenv
,它们分别对应于 Spring Cloud Commons 中的单独的执行器端点 /actuator/refresh
、/actuator/shutdown
和 /actuator/env
。
Bus 刷新端点
/actuator/busrefresh
端点清除 RefreshScope
缓存并重新绑定 @ConfigurationProperties
。 有关更多信息,请参见刷新范围文档。
要暴露 /actuator/busrefresh
端点,您需要将以下配置添加到您的应用程序
management.endpoints.web.exposure.include=busrefresh
Bus Env 端点
/actuator/busenv
端点使用指定的键/值对跨多个实例更新每个实例的环境。
要暴露 /actuator/busenv
端点,您需要将以下配置添加到您的应用程序
management.endpoints.web.exposure.include=busenv
/actuator/busenv
端点接受具有以下形状的 POST
请求
{
"name": "key1",
"value": "value1"
}
Bus 关闭端点
/actuator/busshutdown
优雅地关闭应用程序。
要暴露 /actuator/busshutdown
端点,您需要将以下配置添加到您的应用程序
management.endpoints.web.exposure.include=busshutdown
您可以通过发出 POST
请求来向 busshutdown
端点发出请求。
如果您想定位特定的应用程序,您可以向 /busshutdown
发出 POST
请求,并可以选择指定总线 ID
$ curl -X POST https://:8080/actuator/busshutdown
您还可以通过指定总线 ID 来定位特定的应用程序实例
$ curl -X POST https://:8080/actuator/busshutdown/busid:123