Reads and registers against a Consul agent.
options: ConsulProviderOptions
Agent address, ACL token, datacenter, and wait
http: IDiscoveryHttp
The HTTP seam
kind: string
Backend id.
deregisterSelf(registration: SelfRegistration): Promise<void>
Removes this instance from the agent.
headers(): Record<string, string>
Headers every request carries; the ACL header is omitted when unset.
healthUrl(serviceName: string,index?: number): string
Builds the health-read URL.
Always sends passing=true: self-registration advertises the instance
before its socket is bound, and filtering on passing checks is what makes
that window harmless for every consumer.
isHealthy(): Promise<boolean>
M70c: probes the agent's leader endpoint — GET /v1/status/leader — through
the existing IDiscoveryHttp seam. 2xx means the agent is reachable; any
other status or a transport failure means it is not.
mapEntries(body: unknown,serviceName: string): readonly ServiceInstance[]
Maps a health response body onto instances.
registerSelf(registration: SelfRegistration): Promise<void>
Advertises this instance to the agent.
resolve(serviceName: string): Promise<readonly ServiceInstance[]>
Reads the current instance list for a service.
selfId(registration: SelfRegistration): string
The instance id used for both register and deregister.
Generated once per registration object rather than per call, because a fresh uuid on deregistration would target an id that was never registered.
watch(serviceName: string,listener: (instances: readonly ServiceInstance[]) => void): Promise<Unsubscribe>
Subscribes to instance-list changes.
Push-based where the backend supports it, interval-polled where it does not. The listener always receives the full list.