server:
port: 9927
spring:
application:
name: gta-apigateway
cloud:
nacos:
discovery:
server-addr: 10.10.25.18:8848 # nacos服务地址
namespace: a02ac5d9-a070-45b7-b951-409b8ea963b5
group: SEATA_GROUP
# Nacos 集群配置
#server-addr: 10.10.25.15:8848,10.10.25.18:8848
gateway:
discovery:
locator:
enabled: true
routes:
- id: gta-taskchain-gateway
uri: lb://gta-taskchain
filters:
- name: Hystrix
args:
name: default
fallbackUri: 'forward:/defaultfallback'
predicates:
- Path=/gta-taskchain/doubleTask/**
# - Header=luxToken, (^Tp.*)
# hystrix 信号量隔离,3秒后自动超时
hystrix:
command:
default:
execution:
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 3000
shareSecurityContext: true
@RestController
public class DefaultHystrixController {
@RequestMapping("/defaultfallback")
public Map<String,String> defaultfallback(){
Map<String,String> map = new HashMap<>();
map.put("resultCode","fail");
map.put("resultMessage","请稍后...");
return map;
}
}