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.