Moves ConsulCatalogWatch to TaskScheduler rather than @Scheduled

fixes gh-146
This commit is contained in:
Spencer Gibb
2018-06-05 14:43:37 -04:00
parent 79d703a3db
commit 8d55728418
5 changed files with 96 additions and 17 deletions

View File

@@ -170,6 +170,17 @@ public String serviceUrl() {
}
----
=== Consul Catalog Watch
The Consul Catalog Watch takes advantage of the ability of consul to https://www.consul.io/docs/agent/watches.html#services[watch services]. The Catalog Watch makes a blocking Consul HTTP API call to determine if any services have changed. If there is new service data a Heartbeat Event is published.
To change the frequency of when the Config Watch is called change `spring.cloud.consul.config.discovery.catalog-services-watch-delay`. The default value is 1000, which is in milliseconds. The delay is the amount of time after the end of the previous invocation and the start of the next.
To disable the Catalog Watch set `spring.cloud.consul.discovery.catalog-services-watch.enabled=false`.
The watch uses a Spring `TaskScheduler` to schedule the call to consul. By default it is a `ThreadPoolTaskScheduler` with a `poolSize` of 1. To change the `TaskScheduler`, create a bean of type `TaskScheduler` named with the `ConsulDiscoveryClientConfiguration.CATALOG_WATCH_TASK_SCHEDULER_NAME` constant.
[[spring-cloud-consul-config]]
== Distributed Configuration with Consul