Dose any method in consuldotnet return one service at a time?
Closed this issue · 3 comments
Agent.Services() returns all services in a Dictionary at a time.
At most time I only need query one service. Method Agent.Services() wastes too much time and space.
I know two way to realize this: DNS or HTTP
You can see more information here: https://www.consul.io/intro/getting-started/services.html
Dose any method in consuldotnet return one service at a time?
@lvermeulen You may misunderstand my means. I want to get the service with specified name or id. Not the first service.
For example, $ curl http://localhost:8500/v1/catalog/service/web
will return service named "web"
I want a method in consuldotnet to do the same thing.
This exists and has since inception, but in the Catalog endpoint, not in the Agent endpoint. The Agent endpoint only acts against the connected agent as the name suggests, thus there is only the round trip to localhost (usually, unless you're connecting to a remote instance) and no call to the cluster-wide catalog.
Call Catalog.Service("web")"
if you want to replicate the call to the API that curl http://localhost:8500/v1/catalog/service/web
does.