fallback在Feign和sentinel中的初步理解

fallback管运行异常

blockHandler管配置违规

1.在sentinel中通过@SentinelResource 处理 blockHandler 返回的异常的配置中的 超过限流规则,熔断规则,热点规则的异常处理。fallback管运行异常

@SentinelResource(value = "mobile/getPreliminarySwitch" ,blockHandler = "switchHandleException", blockHandlerClass = {SentinelHandleException.class})
@SentinelResource(value = "mobile/getPreliminarySwitch" ,blockHandler = "switchHandleException", blockHandlerClass = {SentinelHandleException.class}
,fallback = "switchFallBackException", fallbackClass ={SentinelFallback.class})

1. 在openfeign中,fallback处理接口返回的运行异常

@FeignClient(contextId = "remoteHouseService", value = "tsthbpom-house", fallbackFactory = RemoteLogFallbackFactory.class)

posted @ 2023-04-27 10:58  BBS_自律  阅读(153)  评论(0)    收藏  举报