Last active
June 28, 2021 13:44
-
-
Save rubykv/4687c7d8911f6e476ca3eef88057206d to your computer and use it in GitHub Desktop.
Alibaba Sentinel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class TestService { | |
@SentinelResource(value = "getResponseFromFallback", fallback = "fallbackTestMethod", defaultFallback = "defaultFallback") | |
public String getResponseFromFallback(int i) { | |
if (i == 0) { | |
throw new IllegalArgumentException("Error occurred"); | |
} | |
return "success"; | |
} | |
public String fallbackTestMethod(int s, Throwable ex) { | |
return "success from fallback"; | |
} | |
public String defaultFallback() { | |
return "success from default fallback"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment