consul-client icon indicating copy to clipboard operation
consul-client copied to clipboard

How do I "restart" watching Key-Value

Open dyeshurun opened this issue 8 years ago • 4 comments

I am connecting consul using a token that can be revoked and then I am starting to watch for changes using KVCache. When my consul token is expired I see "Error getting response from consul" in the log (coming from ConsulCache onFailure callback). I couldn't find a way to intercept this failure and re-connect to consul. Any idea?

dyeshurun avatar Aug 23 '17 13:08 dyeshurun

You might have to use the lower level API to do this unfortunately. I don't have the time at the moment to update ConsulCache to support this. PRs welcome

rickfast avatar Aug 30 '17 12:08 rickfast

Meanwhile I used "ConsulBookend" , I am checking the status code in the "post" method and do my reconnection there

dyeshurun avatar Aug 30 '17 13:08 dyeshurun

@rickfast what lower level API exactly are you talking about?

koiuo avatar Mar 26 '18 21:03 koiuo

Hello, we have the same problem of reloading the token when it expires. @dyeshurun can you please share the workaround with ConsulBookend you mentioned? I am finding it hard to intercept the 403 on callbacks and consequently stop all services caches and property caches without incurring in interrupted exceptions.

nicolaos avatar Sep 23 '22 07:09 nicolaos