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
1d44a60
commit b2fc02f
Showing
4 changed files
with
45 additions
and
30 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
33 changes: 33 additions & 0 deletions
33
.../com/github/lianjiatech/retrofit/spring/boot/test/degrade/DegradeSentinelApiFallback.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,33 @@ | ||
package com.github.lianjiatech.retrofit.spring.boot.test.degrade; | ||
|
||
import com.github.lianjiatech.retrofit.spring.boot.test.entity.Person; | ||
import com.github.lianjiatech.retrofit.spring.boot.test.entity.Result; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.core.Ordered; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@Slf4j | ||
@Order(value = Ordered.HIGHEST_PRECEDENCE) | ||
public class DegradeSentinelApiFallback implements DegradeSentinelApi { | ||
@Override | ||
public Result<Person> getPerson1(Long id) { | ||
log.info("触发熔断了"); | ||
Result<Person> fallback = new Result<>(); | ||
fallback.setCode(-1) | ||
.setMsg("熔断Person1") | ||
.setData(new Person()); | ||
return fallback; | ||
} | ||
|
||
@Override | ||
public Result<Person> getPerson2(Long id) { | ||
log.info("触发熔断了"); | ||
Result<Person> fallback = new Result<>(); | ||
fallback.setCode(-1) | ||
.setMsg("熔断Person2") | ||
.setData(new Person()); | ||
return fallback; | ||
} | ||
} |
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