领事配置自动回调(事件)休息API

Consul configuration to automatically callback (on event) rest API

是否可以将 Consul 回调“POST”配置为在每次更新服务状态时休息API?

我在文档 (https://www.consul.io/docs/dynamic-app-config/watches#http-endpoint) 中找到了“监视”功能,但似乎该功能不会在调用服务事件时自动调用 Consul API。

拜托,如果有人知道如何做这个任务,将不胜感激!

我找到了解决方案:

在代理命令中(启动 Consul):

sudo consul agent --dev --client 0.0.0.0 --config-file ./path/consul-agent.json

在 consul-agent.json 文件中:

{
“watches”: [
{
“type”: “services”,
“handler_type”: “http”,
“http_handler_config”: {
“path”: “https://localhost/routetocall”,
“method”: “POST”,
“header”: { “Authentication”: [“something”] },
“timeout”: “10s”,
“tls_skip_verify”: true
}
}
]
}