Watching your handlers
Way back in Chapter 5, Little Bo Peep Lost Her Service, where Little Bo Peep lost her service, we touched on the functionality of Consul watches and handlers. Recall that a Consul watch observes any number of parameters within Consul, and based on value changes, can execute a handler to perform some function. Within Chapter 5, Little Bo Peep Lost Her Service, we focused on being able to watch the status of a service, in order to inform a third party about service health. We can use this same functionality, but instead of watching service status, we can watch the status of a parameter within the KV store.
For example, if we wanted to watch our key, using the direct command line, we would execute the following:
$ consul watch -type=key -key=son/seventh/gift { "Key": "son/seventh/gift", "CreateIndex": 194, "ModifyIndex": 237, &...