In spring-cloud-consul-discovery how to configure a watch over services

263 views Asked by At

Consider a scenario where I have a watcher-service which is registered in consul. In this watcher service, I want to trigger some emails based on the behaviour of other services i.e. when other services are up, when a new service is added and when a running service is down.

My question is how can I subscribe to the events of other services. One way I got is to use a scheduler and keep hitting consulClient.agentServices but this seems not an optimal way. I am hoping that I should be able to add a listener / watcher which invoke method which inturn tells watcher-service which service is down/added.

Looking for solutions which are more specific to spring cloud consul, but all hints are warmly welcome.

0

There are 0 answers