有没有办法用Hystrix命令包装一个http:outbound gateway REST API调用?我看到了一些使用自定义请求处理程序建议的参考,不确定我该如何去做。
发布于 2018-05-02 21:09:03
请看这里:Wrap spring integration outbound gateway calls with hystrix command。我不能以duplicate的身份结束你的问题,因为没有人投票支持我的答案。但仍然:同样的解决方案必须应用于您的用例:
@ServiceActivator(inputChannel = "serviceChannel")
@HystrixCommand(fallbackMethod = "serviceFallback")
public String myService(String payload) {
// Some external service call
}
public String serviceFallback(String payload) {
// some fallback logic
}另请参阅我的发件箱中的示例:https://github.com/artembilan/sendbox/tree/master/spring-integration-with-hystrix
https://stackoverflow.com/questions/50125060
复制相似问题