Hi,
The idea sounds good.
And, we need the real discovery module to export some method, as to implement
the _M.dump_datainterface, which is optional.
function _M.dump_data()
return {config = local_conf.discovery.consul_kv, services = applications}
end
So, the default api path would be :
/v1/discovery/<discovery_type>/dump
2021年2月2日 19:23,Zexuan Luo
<[email protected]<mailto:[email protected]>> 写道:
Since most of service discovery require a dump method, I think it would be
better to implement a common dump method, and use discovery type as an
argument. Therefore we don't need to implement a dump method per service
discovery.
We can require each service discovery to provide two methods:
1. get all known services
2. get the data according to the service.
聂永 <[email protected]<mailto:[email protected]>> 于2021年2月2日周二
上午10:11写道:
The discovery has many modules, such as eureka,consul_kv,etcd_kv, and so
on .
The modules api URI template should have a good structure:
/v1/discovery/<discovery_type>/<service_name>
So, the http api URI path =
The fixed prefix: /v1/discovery/ + defined discovery_type in yaml (eg:
eureka) + defined uris(eg: /dump)
My discovery_type is consul_kv, the consul_kv’s control api:
function _M.control_api()
return {
{
methods = {"GET"},
uris = {"/dump"},
handler = dump_info
},
{
methods = {"PUT"},
uris = {"/update_kv"},
handler = update_info
}
}
end
eg:
* /v1/discovery/consul_kv/dump
* /v1/discovery/consul_kv/update_kv
We maybe need another discovery module in future, as consul_service, we
maybe need export the debugging api below:
* /v1/discovery/consul_service/view_all_services
What do you think ?
2021年2月1日 10:49,Zexuan Luo
<[email protected]<mailto:[email protected]><mailto:
[email protected]<mailto:[email protected]>>> 写道:
I am confused by the ` defined uris(eg: `/dump`)` part. Why should we need
another part for the uri?
Why not use `v1/discovery/dump`?
聂永
<[email protected]<mailto:[email protected]><mailto:[email protected]>>
于2021年2月1日周一
上午9:53写道:
Hi,
We don't need hardcode for discovery module's control api path.
The real http api path =
The fixed prefix: `/v1/discovery/` + defined `discovery_type` in yaml (eg:
`eureka`) + defined uris(eg: `/dump`)
2021年1月29日 22:13,Zexuan Luo
<[email protected]<mailto:[email protected]><mailto:
[email protected]<mailto:[email protected]>><mailto:
[email protected]<mailto:[email protected]><mailto:[email protected]>>>
写道:
discovery typ