Hystrix with Spring Integration

人盡茶涼 提交于 2019-12-11 07:02:52

问题


I am trying to see the feasibility of using Spring Integration in my new project. It is a microservices based project with a central component where I want to put in place Spring integration component which essentially act as a orchestration component which will orchestrate the calls to all the external microservices. The current issue is I am trying but I am not yet able to get spring cloud hystrix circuit breaker work with Spring integration. I tried java dsl as well, but for the moment I am clueless. I really want to use hystrix for the circuit breaker so that I can use the hystrix dashboard with the project as well. Any help or a small example would really help


回答1:


Well, if the story is about Circuit Breaker, you should consider to implement AbstractRequestHandlerAdvice for that Hystrix command. Docs on the matter.

You can borrow some ideas how to do that from the existing RequestHandlerCircuitBreakerAdvice. The sample on the matter.

I think the feature with fallbackMethod could be possible as a combination of the ExpressionEvaluatingRequestHandlerAdvice with its failureChannel and trapException to true and RequestHandlerCircuitBreakerAdvice as the next in a chain. That way you all the exceptions downstream will be caught by the ExpressionEvaluatingRequestHandlerAdvice and send to the channel which we may treat as a fallbackMethod in Hystrix terms.



来源:https://stackoverflow.com/questions/45480446/hystrix-with-spring-integration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!