method DnsProvider.prototype.watch
DnsProvider.prototype.watch(
serviceName: string,
listener: (instances: readonly ServiceInstance[]) => void
): Promise<Unsubscribe>

Polls at watchIntervalMs, firing only when the instance list changed.

DNS has no push channel. Polling is the honest implementation: a watch() that never fires would be worse than a documented interval.

Parameters

serviceName: string
listener: (instances: readonly ServiceInstance[]) => void

Return Type

Promise<Unsubscribe>

Usage

import { DnsProvider } from "service-discovery-plugin/src/index.ts";