Skip to content

Commit f7cbb4b

Browse files
committed
Add Task Service api gateway and task-service fallback method
1 parent 9fa36fc commit f7cbb4b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

cloud-gateway/src/main/java/com/cevher/ms/cloud/gateway/FallBackController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ public String userServiceFallBack(){
1515
public String departmentServiceFallBack(){
1616
return "FallBack Controller!.. Department Service is taking longer then Expected.";
1717
}
18+
@GetMapping("/taskServiceFallBack")
19+
public String taskServiceFallBack(){
20+
return "FallBack Controller!.. Task Service is taking longer then Expected.";
21+
}
1822
}

cloud-gateway/src/main/resources/application.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@ spring:
2626
args:
2727
name: department-service
2828
fallbackuri: forward:/departmentServiceFallBack
29-
29+
- id: task-service
30+
uri: lb://task-service
31+
predicates:
32+
- Path=/tasks/**
33+
filters:
34+
- name: CircuitBreaker
35+
args:
36+
name: task-service
37+
fallbackuri: forward:/taskServiceFallBack
3038
hystrix:
3139
command:
3240
fallbackcmd:

0 commit comments

Comments
 (0)