The watcher calls the KV Store API to watch all keys used for the distributed configurations,
using Blocking Queries
to wait for any changes made on those keys.
If no change occurred during the max-wait-duration
, the query will be re-executed after the delay-duration
.
When a change is detected in a KV used for configurations,
the corresponding PropertySource
will be updated and a RefreshEvent
published.
See Micronaut > Refreshable Scope for more details
The watcher can be configured using
micronaut:
application:
name: hello-world
config-client:
enabled: true
consul:
client:
defaultZone: "${CONSUL_HOST:localhost}:${CONSUL_PORT:8500}"
config:
format: YAML
path: /config
watch:
disabled: false # to disable the watcher, during test for instance
max-wait-duration: 10m # Sets the maximum duration for the blocking request
delay-duration: 50ms # Sets the watch delay before each call to avoid flooding
Formats supported are
NATIVE
JSON
PROPERTIES
YAML
Read Micronaut > Distributed Configuration > HashiCorp Consul Support for more details.