Register Consul watches via http

Currently there are two ways to register consul watches https://www.consul.io/docs/dynamic-app-config/watches:

  • via consul watch command

  • via json file with subsequent consul reload

We ate trying to use consul as ‘dns’ for cluster services. We register service watches to get notification event from consul when particular service is added or deleted to the pool.
we could not use ‘consul watch’ command because it’s locking, but we use json file approach. The issue is ‘consul reload’ command is very expensive ( take tens of seconds) and time is growing fast when number of services pass few thousands…

Did anyone knows if there is a way to register/de-register watches dynamically via http api ?

Hi @nimDevOps,

Consul does not provide any additional methods for configuring watches beyond what you have already identified.

Would you mind describing the configuration of your environment in a bit more detail? Are you utilizing Consul’s DNS server for service discovery? Are you registering a separate watch on a per-service basis, or a smaller number of watches which monitor for changes across the entire service catalog?