Commit 32abaf2b by Nepxion

重构Sentinel

parent cb012f99
......@@ -25,7 +25,7 @@ import com.nepxion.discovery.plugin.example.service.impl.MyLoadBalanceListener;
import com.nepxion.discovery.plugin.example.service.impl.MyRegisterListener;
import com.nepxion.discovery.plugin.example.service.impl.MySubscriber;
import com.nepxion.discovery.plugin.example.service.sentinel.MyRestTemplateBlockHandler;
import com.nepxion.discovery.plugin.example.service.sentinel.MyRestTemplateFallbackHanlder;
import com.nepxion.discovery.plugin.example.service.sentinel.MyRestTemplateFallbackHandler;
import com.nepxion.discovery.plugin.example.service.sentinel.MySentinelFlowRuleParser;
import com.nepxion.discovery.plugin.strategy.service.aop.RestTemplateStrategyInterceptor;
......@@ -43,7 +43,7 @@ public class DiscoveryApplicationA1 {
@Bean
@LoadBalanced
@SentinelRestTemplate(blockHandler = "handleBlock", blockHandlerClass = MyRestTemplateBlockHandler.class, fallback = "handleFallback", fallbackClass = MyRestTemplateFallbackHanlder.class)
@SentinelRestTemplate(blockHandler = "handleBlock", blockHandlerClass = MyRestTemplateBlockHandler.class, fallback = "handleFallback", fallbackClass = MyRestTemplateFallbackHandler.class)
public RestTemplate restTemplate(@Autowired(required = false) RestTemplateStrategyInterceptor restTemplateStrategyInterceptor) {
RestTemplate restTemplate = new RestTemplate();
if (restTemplateStrategyInterceptor != null) {
......
......@@ -12,8 +12,8 @@ package com.nepxion.discovery.plugin.example.service.sentinel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MyRestTemplateFallbackHanlder {
private static final Logger LOG = LoggerFactory.getLogger(MyRestTemplateFallbackHanlder.class);
public class MyRestTemplateFallbackHandler {
private static final Logger LOG = LoggerFactory.getLogger(MyRestTemplateFallbackHandler.class);
public static void hanldleFallback() {
LOG.info("Sentinel RestTemplate Client Fallback Causes");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment