是否可以在每次更新服务状态时将领事回调"POST“配置到rest API?
我在文档中找到了"Watch“功能(https://www.consul.io/docs/dynamic-app-config/watches#http-endpoint),但此功能似乎不会在调用服务事件时自动Consul调用某些API。
请,如果有人知道如何做这项任务,将非常感谢!
发布于 2021-02-25 03:32:40
我找到了一个解决方案:
在代理命令中(启动领事):
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
}
}
]
}
https://stackoverflow.com/questions/66320450
复制相似问题