forked from LianjiaTech/retrofit-spring-boot-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ce0ba5
commit 3803fe9
Showing
12 changed files
with
180 additions
and
131 deletions.
There are no files selected for viewing
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
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
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
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
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
9 changes: 0 additions & 9 deletions
9
src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/DegradeInterceptor.java
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/DegradeType.java
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/main/java/com/github/lianjiatech/retrofit/spring/boot/degrade/RetrofitDegrade.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.github.lianjiatech.retrofit.spring.boot.degrade; | ||
|
||
import okhttp3.Interceptor; | ||
|
||
/** | ||
* @author 陈添明 | ||
* @since 2022/4/30 3:34 下午 | ||
*/ | ||
public interface RetrofitDegrade extends Interceptor { | ||
|
||
String NONE = "none"; | ||
String SENTINEL = "sentinel"; | ||
|
||
/** | ||
* 对于指定Retrofit接口,是否允许降级 | ||
* @param retrofitInterface Retrofit接口 | ||
* @return 是否允许降级 | ||
*/ | ||
boolean isEnableDegrade(Class<?> retrofitInterface); | ||
|
||
/** | ||
* 加载指定Retrofit接口下的降级规则 | ||
* @param retrofitInterface Retrofit接口 | ||
*/ | ||
void loadDegradeRules(Class<?> retrofitInterface); | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
...m/github/lianjiatech/retrofit/spring/boot/degrade/release4j/Release4jRetrofitDegrade.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.github.lianjiatech.retrofit.spring.boot.degrade.release4j; | ||
|
||
import java.io.IOException; | ||
|
||
import com.github.lianjiatech.retrofit.spring.boot.degrade.RetrofitDegrade; | ||
|
||
import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry; | ||
import okhttp3.Response; | ||
|
||
/** | ||
* @author 陈添明 | ||
* @since 2022/5/1 8:02 下午 | ||
*/ | ||
public class Release4jRetrofitDegrade implements RetrofitDegrade { | ||
|
||
@Override | ||
public boolean isEnableDegrade(Class<?> retrofitInterface) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void loadDegradeRules(Class<?> retrofitInterface) { | ||
CircuitBreakerRegistry registry = new CircuitBreakerRegistry.Builder() | ||
.build(); | ||
} | ||
|
||
@Override | ||
public Response intercept(Chain chain) throws IOException { | ||
return null; | ||
} | ||
} |
52 changes: 0 additions & 52 deletions
52
.../github/lianjiatech/retrofit/spring/boot/degrade/sentinel/SentinelDegradeInterceptor.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.