英文:
How to completely stop the circuit breaker in Vertx
问题
我正在开发一个使用Vertx的应用程序。在其中,我有一个NetClient,并且使用Vertx Circuit Breaker来持续保持与服务器的连接。我现在正在处理一个需要在某个时刻取消部署这些Verticle的任务,但是当我这样做时,似乎电路断路器出于某种原因在Verticle取消部署成功后仍然保持活动状态。
我尝试在取消部署之前调用电路断路器的关闭方法,但即使这样,我得到的结果非常不一致。第一次可以工作,但第二次,电路断路器仍然保持活动状态。
不知道是否有可能在启动后完全终止电路断路器?
使用:Java 8和Vertx 3.8.1
英文:
I am working on an application that is using the Vertx. In it, I have a NetClient and uses the Vertx Circuit Breaker for a continuously stay connected to a server. I now am working on something that requires these Verticles to be undeployed at some point but when I do, it seems like the circuit breaker for some reason stays alive even after verticle.undeploy has succeeded.
I've tried calling the close method for the Circuit Breaker before undeploying, but even with that, I get a very inconsistent result. First time it works but second time around, the circuit breaker stays alive.
Any idea if it's possible to completely kill the circuit breaker once started?
Using: Java 8 and Vertx 3.8.1
答案1
得分: 0
如果有人对此有一个好的和一致的解决方案,我会很乐意将选定的答案更改为该解决方案,但由于我没有看到任何回复,我将分享我最终的做法。
我基本上放弃了试图终止断路器。相反,我在中间添加了逻辑来考虑一个附加状态。有了这个变量,我要么执行所需的代码,要么将断路器发送到一个无限的等待循环,直到收到外部请求以退出该循环并返回到断路器循环。
也许这是更合理的方法,老实说我不太确定,但我能够用这个方法实现我所需的功能。
英文:
If anyone has a good and consistent solution to this, I'd be happy to change the selected answer to it but since I don't see any responses, I will share what I ended up doing with this.
I basically gave up trying to kill the circuit breaker. Instead, I added logic in between to consider an additional state. With this variable, I either executed the desired code or sent the circuit breaker in a infinite waiting-loop until an external request is received to break out of that loop and go back to the circuit breaker loop.
Maybe this is the more logical approach, I'm honestly not sure but I was able to achieve what I needed with this.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论